https://bugs.webkit.org/show_bug.cgi?id=84249
Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-04-18
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:
JSArray's m_subclassData is only used by WebCore's RuntimeArray. This patch moves
the attribute to RuntimeArray to avoid allocating memory for the pointer in the common
case.
This gives ~1% improvement in JSArray creation microbenchmark thanks to fewer allocations
of CopiedSpace.
* jit/JITInlineMethods.h:
(JSC::JIT::emitAllocateJSArray):
* runtime/JSArray.cpp:
(JSC::JSArray::JSArray):
* runtime/JSArray.h:
Source/WebCore:
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::RuntimeArray):
(JSC::RuntimeArray::finishCreation):
* bridge/runtime_array.h:
(JSC::RuntimeArray::getLength):
(JSC::RuntimeArray::getConcreteArray):
(RuntimeArray):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114539
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2012-04-18 Benjamin Poulain <bpoulain@apple.com>
+ Remove m_subclassData from JSArray, move the attribute to subclass as needed
+ https://bugs.webkit.org/show_bug.cgi?id=84249
+
+ Reviewed by Geoffrey Garen.
+
+ JSArray's m_subclassData is only used by WebCore's RuntimeArray. This patch moves
+ the attribute to RuntimeArray to avoid allocating memory for the pointer in the common
+ case.
+
+ This gives ~1% improvement in JSArray creation microbenchmark thanks to fewer allocations
+ of CopiedSpace.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitAllocateJSArray):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ * runtime/JSArray.h:
+
+2012-04-18 Benjamin Poulain <bpoulain@apple.com>
+
replaceUsingStringSearch: delay the creation of the replace string until needed
https://bugs.webkit.org/show_bug.cgi?id=83841
store32(Imm32(initialLength), Address(cellResult, JSArray::vectorLengthOffset()));
store32(TrustedImm32(0), Address(cellResult, JSArray::indexBiasOffset()));
- // Initialize the subclass data and the sparse value map.
- storePtr(TrustedImmPtr(0), Address(cellResult, JSArray::subclassDataOffset()));
+ // Initialize the sparse value map.
storePtr(TrustedImmPtr(0), Address(cellResult, JSArray::sparseValueMapOffset()));
// Store the values we have.
, m_indexBias(0)
, m_storage(0)
, m_sparseValueMap(0)
- , m_subclassData(0)
{
}
return numDefined;
}
-void* JSArray::subclassData() const
-{
- return m_subclassData;
-}
-
-void JSArray::setSubclassData(void* d)
-{
- m_subclassData = d;
-}
-
#if CHECK_ARRAY_CONSISTENCY
void JSArray::checkConsistency(ConsistencyCheckType type)
// FIXME: Maybe SparseArrayValueMap should be put into its own JSCell?
SparseArrayValueMap* m_sparseValueMap;
- void* m_subclassData; // A JSArray subclass can use this to fill the vector lazily.
static ptrdiff_t sparseValueMapOffset() { return OBJECT_OFFSETOF(JSArray, m_sparseValueMap); }
- static ptrdiff_t subclassDataOffset() { return OBJECT_OFFSETOF(JSArray, m_subclassData); }
static ptrdiff_t indexBiasOffset() { return OBJECT_OFFSETOF(JSArray, m_indexBias); }
};
+2012-04-18 Benjamin Poulain <bpoulain@apple.com>
+
+ Remove m_subclassData from JSArray, move the attribute to subclass as needed
+ https://bugs.webkit.org/show_bug.cgi?id=84249
+
+ Reviewed by Geoffrey Garen.
+
+ * bridge/runtime_array.cpp:
+ (JSC::RuntimeArray::RuntimeArray):
+ (JSC::RuntimeArray::finishCreation):
+ * bridge/runtime_array.h:
+ (JSC::RuntimeArray::getLength):
+ (JSC::RuntimeArray::getConcreteArray):
+ (RuntimeArray):
+
2012-04-18 Luiz Agostini <luiz.agostini@palm.com>
matchMedia() MediaQueryList not updating
RuntimeArray::RuntimeArray(ExecState* exec, Structure* structure)
: JSArray(exec->globalData(), structure)
+ , m_array(0)
{
}
{
Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
- setSubclassData(array);
+ m_array = array;
}
RuntimeArray::~RuntimeArray()
static bool deleteProperty(JSCell*, ExecState*, const Identifier &propertyName);
static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
- unsigned getLength() const { return getConcreteArray()->getLength(); }
+ unsigned getLength() const { return m_array->getLength(); }
- Bindings::Array* getConcreteArray() const { return static_cast<BindingsArray*>(subclassData()); }
+ Bindings::Array* getConcreteArray() const { return m_array; }
static const ClassInfo s_info;
RuntimeArray(ExecState*, Structure*);
static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
static JSValue indexGetter(ExecState*, JSValue, unsigned);
+
+ BindingsArray* m_array;
};
} // namespace JSC