- Revision
- 114539
- Author
- benja...@webkit.org
- Date
- 2012-04-18 11:36:59 -0700 (Wed, 18 Apr 2012)
Log Message
Remove m_subclassData from JSArray, move the attribute to subclass as needed
https://bugs.webkit.org/show_bug.cgi?id=84249
Patch by Benjamin Poulain <bpoul...@apple.com> on 2012-04-18
Reviewed by Geoffrey Garen.
Source/_javascript_Core:
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):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (114538 => 114539)
--- trunk/Source/_javascript_Core/ChangeLog 2012-04-18 18:34:42 UTC (rev 114538)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-04-18 18:36:59 UTC (rev 114539)
@@ -1,5 +1,25 @@
2012-04-18 Benjamin Poulain <bpoul...@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 <bpoul...@apple.com>
+
replaceUsingStringSearch: delay the creation of the replace string until needed
https://bugs.webkit.org/show_bug.cgi?id=83841
Modified: trunk/Source/_javascript_Core/jit/JITInlineMethods.h (114538 => 114539)
--- trunk/Source/_javascript_Core/jit/JITInlineMethods.h 2012-04-18 18:34:42 UTC (rev 114538)
+++ trunk/Source/_javascript_Core/jit/JITInlineMethods.h 2012-04-18 18:36:59 UTC (rev 114539)
@@ -503,8 +503,7 @@
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.
Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (114538 => 114539)
--- trunk/Source/_javascript_Core/runtime/JSArray.cpp 2012-04-18 18:34:42 UTC (rev 114538)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp 2012-04-18 18:36:59 UTC (rev 114539)
@@ -130,7 +130,6 @@
, m_indexBias(0)
, m_storage(0)
, m_sparseValueMap(0)
- , m_subclassData(0)
{
}
@@ -1810,16 +1809,6 @@
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)
Modified: trunk/Source/_javascript_Core/runtime/JSArray.h (114538 => 114539)
--- trunk/Source/_javascript_Core/runtime/JSArray.h 2012-04-18 18:34:42 UTC (rev 114538)
+++ trunk/Source/_javascript_Core/runtime/JSArray.h 2012-04-18 18:36:59 UTC (rev 114539)
@@ -317,10 +317,8 @@
// 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); }
};
Modified: trunk/Source/WebCore/ChangeLog (114538 => 114539)
--- trunk/Source/WebCore/ChangeLog 2012-04-18 18:34:42 UTC (rev 114538)
+++ trunk/Source/WebCore/ChangeLog 2012-04-18 18:36:59 UTC (rev 114539)
@@ -1,3 +1,18 @@
+2012-04-18 Benjamin Poulain <bpoul...@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.agost...@palm.com>
matchMedia() MediaQueryList not updating
Modified: trunk/Source/WebCore/bridge/runtime_array.cpp (114538 => 114539)
--- trunk/Source/WebCore/bridge/runtime_array.cpp 2012-04-18 18:34:42 UTC (rev 114538)
+++ trunk/Source/WebCore/bridge/runtime_array.cpp 2012-04-18 18:36:59 UTC (rev 114539)
@@ -39,6 +39,7 @@
RuntimeArray::RuntimeArray(ExecState* exec, Structure* structure)
: JSArray(exec->globalData(), structure)
+ , m_array(0)
{
}
@@ -46,7 +47,7 @@
{
Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
- setSubclassData(array);
+ m_array = array;
}
RuntimeArray::~RuntimeArray()
Modified: trunk/Source/WebCore/bridge/runtime_array.h (114538 => 114539)
--- trunk/Source/WebCore/bridge/runtime_array.h 2012-04-18 18:34:42 UTC (rev 114538)
+++ trunk/Source/WebCore/bridge/runtime_array.h 2012-04-18 18:36:59 UTC (rev 114539)
@@ -60,9 +60,9 @@
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;
@@ -85,6 +85,8 @@
RuntimeArray(ExecState*, Structure*);
static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
static JSValue indexGetter(ExecState*, JSValue, unsigned);
+
+ BindingsArray* m_array;
};
} // namespace JSC