Allocate the whole RegExpMatchesArray backing store up front.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Aug 2014 03:22:01 +0000 (03:22 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Aug 2014 03:22:01 +0000 (03:22 +0000)
commit369bed8d3f0641e80c26e69a60692d1ff06da86e
tree103d3cba09488bad360e3db08891b35f2d705ae9
parent0b6759b4307188dc513d28d85b91877c820dd6cc
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSArray.h
Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp