Title: [172618] trunk/Source/_javascript_Core
- Revision
- 172618
- Author
- [email protected]
- Date
- 2014-08-14 20:22:01 -0700 (Thu, 14 Aug 2014)
Log Message
Allocate the whole RegExpMatchesArray backing store up front.
<https://webkit.org/b/135217>
We were using the generic array backing store allocation path for
RegExpMatchesArray which meant starting with 4 slots and then growing
it dynamically as we append. Since we always know the final number of
entries up front, allocate a perfectly-sized backing store right away.
~2% progression on Octane/regexp.
Reviewed by Geoffrey Garen.
* runtime/JSArray.h:
(JSC::createArrayButterflyWithExactLength):
* runtime/RegExpMatchesArray.cpp:
(JSC::RegExpMatchesArray::create):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (172617 => 172618)
--- trunk/Source/_javascript_Core/ChangeLog 2014-08-15 00:30:38 UTC (rev 172617)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-08-15 03:22:01 UTC (rev 172618)
@@ -1,3 +1,22 @@
+2014-08-14 Andreas Kling <[email protected]>
+
+ Allocate the whole RegExpMatchesArray backing store up front.
+ <https://webkit.org/b/135217>
+
+ We were using the generic array backing store allocation path for
+ RegExpMatchesArray which meant starting with 4 slots and then growing
+ it dynamically as we append. Since we always know the final number of
+ entries up front, allocate a perfectly-sized backing store right away.
+
+ ~2% progression on Octane/regexp.
+
+ Reviewed by Geoffrey Garen.
+
+ * runtime/JSArray.h:
+ (JSC::createArrayButterflyWithExactLength):
+ * runtime/RegExpMatchesArray.cpp:
+ (JSC::RegExpMatchesArray::create):
+
2014-08-14 Saam Barati <[email protected]>
Allow high fidelity type profiling to be enabled and disabled.
Modified: trunk/Source/_javascript_Core/runtime/JSArray.h (172617 => 172618)
--- trunk/Source/_javascript_Core/runtime/JSArray.h 2014-08-15 00:30:38 UTC (rev 172617)
+++ trunk/Source/_javascript_Core/runtime/JSArray.h 2014-08-15 03:22:01 UTC (rev 172618)
@@ -190,6 +190,18 @@
return result;
}
+inline Butterfly* createArrayButterflyWithExactLength(VM& vm, JSCell* intendedOwner, unsigned initialLength)
+{
+ Butterfly* butterfly = Butterfly::create(
+ vm, intendedOwner, 0, 0, true, indexingHeaderForArray(initialLength, initialLength),
+ ArrayStorage::sizeFor(initialLength));
+ ArrayStorage* storage = butterfly->arrayStorage();
+ storage->m_indexBias = 0;
+ storage->m_sparseMap.clear();
+ storage->m_numValuesInVector = 0;
+ return butterfly;
+}
+
inline Butterfly* createArrayButterfly(VM& vm, JSCell* intendedOwner, unsigned initialLength)
{
Butterfly* butterfly = Butterfly::create(
Modified: trunk/Source/_javascript_Core/runtime/RegExpMatchesArray.cpp (172617 => 172618)
--- trunk/Source/_javascript_Core/runtime/RegExpMatchesArray.cpp 2014-08-15 00:30:38 UTC (rev 172617)
+++ trunk/Source/_javascript_Core/runtime/RegExpMatchesArray.cpp 2014-08-15 03:22:01 UTC (rev 172618)
@@ -46,7 +46,7 @@
{
ASSERT(result);
VM& vm = exec->vm();
- Butterfly* butterfly = createArrayButterfly(vm, 0, regExp->numSubpatterns() + 1);
+ Butterfly* butterfly = createArrayButterflyWithExactLength(vm, 0, regExp->numSubpatterns() + 1);
RegExpMatchesArray* array = new (NotNull, allocateCell<RegExpMatchesArray>(vm.heap)) RegExpMatchesArray(vm, butterfly, exec->lexicalGlobalObject(), input, regExp, result);
array->finishCreation(vm);
return array;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes