[DFG] Fold GetByVal if Array is CoW
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2018 21:25:19 +0000 (21:25 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2018 21:25:19 +0000 (21:25 +0000)
commit8d374bd8deb6e53b33ba354b5fb95b1cfe9d3bfe
treeaa84c5be868ba5c8666872ef39a9068c956cc902
parentc56fb6bb2496efbb6d0d3136f75c246cfce95051
[DFG] Fold GetByVal if Array is CoW
https://bugs.webkit.org/show_bug.cgi?id=186459

Reviewed by Saam Barati.

JSTests:

* stress/folding-get-by-val-with-immutable-butterfly-out-of-bounds-foldable.js: Added.
(shouldBe):
(test0):
(test1):
(test2):
(test3):
(test4):
(test5):
* stress/folding-get-by-val-with-immutable-butterfly-out-of-bounds.js: Added.
(shouldBe):
(test0):
(test1):
(test2):
(test3):
(test4):
(test5):
* stress/folding-get-by-val-with-immutable-butterfly-with-types.js: Added.
(shouldBe):
(test0):
(test1):
(test2):
(test3):
(test4):
(test5):
* stress/folding-get-by-val-with-immutable-butterfly.js: Added.
(shouldBe):
(checking):
(test):

Source/JavaScriptCore:

CoW indexing type means that we now tracks the changes in CoW Array by structure. So DFG has a chance to
fold GetByVal if the given array is CoW. This patch folds GetByVal onto the CoW Array. If the structure
is watched and the butterfly is JSImmutableButterfly, we can load the value from this butterfly.

This can be useful since these CoW arrays are used for a storage for constants. Constant-indexed access
to these constant arrays can be folded into an actual constant by this patch.

                                   baseline                  patched

template_string.es6          4993.9853+-147.5308   ^    824.1685+-44.1839       ^ definitely 6.0594x faster
template_string_tag.es5        67.0822+-2.0100     ^      9.3540+-0.5376        ^ definitely 7.1715x faster

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/folding-get-by-val-with-immutable-butterfly-out-of-bounds-foldable.js [new file with mode: 0644]
JSTests/stress/folding-get-by-val-with-immutable-butterfly-out-of-bounds.js [new file with mode: 0644]
JSTests/stress/folding-get-by-val-with-immutable-butterfly-with-types.js [new file with mode: 0644]
JSTests/stress/folding-get-by-val-with-immutable-butterfly.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h