Introduce put_by_id like IC into put_by_val when the given name is String or Symbol
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Aug 2015 20:18:45 +0000 (20:18 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Aug 2015 20:18:45 +0000 (20:18 +0000)
commit7ba04ddb16cc488bae1e19a716a1c8aa1f8d0295
treeb7daf410fd6967f6009f394da104916bd98a7f09
parent8ecc96047c2b3d509868c7453dab9e53adbc46d6
Introduce put_by_id like IC into put_by_val when the given name is String or Symbol
https://bugs.webkit.org/show_bug.cgi?id=147760

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

This patch adds put_by_id IC to put_by_val by caching the one candidate id,
it is the same thing to the get_by_val IC extension.
It will encourage the use of ES6 Symbols and ES6 computed properties in the object literals.

In this patch, we leverage the existing CheckIdent and PutById / PutByVal in DFG,
so this patch does not change FTL because the above operations are already supported in FTL.

And this patch also includes refactoring to leverage byValInfo->slowPathCount in the cached Id path.

Performance results report there's no regression in the existing tests. And in the synthetic
benchmarks created by modifying put-by-id to put-by-val, we can see significant performance
improvements up to 13.9x.

* bytecode/PutByIdStatus.cpp:
(JSC::PutByIdStatus::computeForStubInfo):
* bytecode/PutByIdStatus.h:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* jit/JIT.h:
(JSC::JIT::compilePutByValWithCachedId):
* jit/JITOperations.cpp:
(JSC::getByVal):
(JSC::tryGetByValOptimize):
* jit/JITOperations.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitGetByValWithCachedId):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitPutByValWithCachedId):
(JSC::JIT::emitSlow_op_put_by_val):
(JSC::JIT::emitIdentifierCheck):
(JSC::JIT::privateCompilePutByValWithCachedId):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emitGetByValWithCachedId):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitPutByValWithCachedId):
(JSC::JIT::emitSlow_op_put_by_val):
* tests/stress/put-by-val-with-string-break.js: Added.
(shouldBe):
(assign):
* tests/stress/put-by-val-with-string-generated.js: Added.
(shouldBe):
(gen1):
(gen2):
(assign):
* tests/stress/put-by-val-with-string-generic.js: Added.
(shouldBe):
(assign):
* tests/stress/put-by-val-with-symbol-break.js: Added.
(shouldBe):
(assign):
* tests/stress/put-by-val-with-symbol-generic.js: Added.
(shouldBe):
(assign):

LayoutTests:

Add synthetic tests for put-by-val. Just make put-by-id tests using symbol / string.

* js/regress/fold-put-by-val-with-string-to-multi-put-by-offset-expected.txt: Added.
* js/regress/fold-put-by-val-with-string-to-multi-put-by-offset.html: Added.
* js/regress/fold-put-by-val-with-symbol-to-multi-put-by-offset-expected.txt: Added.
* js/regress/fold-put-by-val-with-symbol-to-multi-put-by-offset.html: Added.
* js/regress/inlined-put-by-val-with-string-transition-expected.txt: Added.
* js/regress/inlined-put-by-val-with-string-transition.html: Added.
* js/regress/inlined-put-by-val-with-symbol-transition-expected.txt: Added.
* js/regress/inlined-put-by-val-with-symbol-transition.html: Added.
* js/regress/polymorphic-put-by-val-with-string-expected.txt: Added.
* js/regress/polymorphic-put-by-val-with-string.html: Added.
* js/regress/polymorphic-put-by-val-with-symbol-expected.txt: Added.
* js/regress/polymorphic-put-by-val-with-symbol.html: Added.
* js/regress/put-by-val-with-string-expected.txt: Added.
* js/regress/put-by-val-with-string-replace-and-transition-expected.txt: Added.
* js/regress/put-by-val-with-string-replace-and-transition.html: Added.
* js/regress/put-by-val-with-string-slightly-polymorphic-expected.txt: Added.
* js/regress/put-by-val-with-string-slightly-polymorphic.html: Added.
* js/regress/put-by-val-with-string.html: Added.
* js/regress/put-by-val-with-symbol-expected.txt: Added.
* js/regress/put-by-val-with-symbol-replace-and-transition-expected.txt: Added.
* js/regress/put-by-val-with-symbol-replace-and-transition.html: Added.
* js/regress/put-by-val-with-symbol-slightly-polymorphic-expected.txt: Added.
* js/regress/put-by-val-with-symbol-slightly-polymorphic.html: Added.
* js/regress/put-by-val-with-symbol.html: Added.
* js/regress/script-tests/fold-put-by-val-with-string-to-multi-put-by-offset.js: Added.
(foo):
(fu):
(bar):
* js/regress/script-tests/fold-put-by-val-with-symbol-to-multi-put-by-offset.js: Added.
(foo):
(fu):
(bar):
* js/regress/script-tests/inlined-put-by-val-with-string-transition.js: Added.
(foo):
(Foo):
* js/regress/script-tests/inlined-put-by-val-with-symbol-transition.js: Added.
(foo):
(Foo):
* js/regress/script-tests/polymorphic-put-by-val-with-string.js: Added.
(foo):
* js/regress/script-tests/polymorphic-put-by-val-with-symbol.js: Added.
(foo):
* js/regress/script-tests/put-by-val-with-string-replace-and-transition.js: Added.
* js/regress/script-tests/put-by-val-with-string-slightly-polymorphic.js: Added.
* js/regress/script-tests/put-by-val-with-string.js: Added.
(foo):
(bar):
* js/regress/script-tests/put-by-val-with-symbol-replace-and-transition.js: Added.
* js/regress/script-tests/put-by-val-with-symbol-slightly-polymorphic.js: Added.
* js/regress/script-tests/put-by-val-with-symbol.js: Added.
(foo):
(bar):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
51 files changed:
LayoutTests/ChangeLog
LayoutTests/js/regress/fold-put-by-val-with-string-to-multi-put-by-offset-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/fold-put-by-val-with-string-to-multi-put-by-offset.html [new file with mode: 0644]
LayoutTests/js/regress/fold-put-by-val-with-symbol-to-multi-put-by-offset-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/fold-put-by-val-with-symbol-to-multi-put-by-offset.html [new file with mode: 0644]
LayoutTests/js/regress/inlined-put-by-val-with-string-transition-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/inlined-put-by-val-with-string-transition.html [new file with mode: 0644]
LayoutTests/js/regress/inlined-put-by-val-with-symbol-transition-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/inlined-put-by-val-with-symbol-transition.html [new file with mode: 0644]
LayoutTests/js/regress/polymorphic-put-by-val-with-string-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/polymorphic-put-by-val-with-string.html [new file with mode: 0644]
LayoutTests/js/regress/polymorphic-put-by-val-with-symbol-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/polymorphic-put-by-val-with-symbol.html [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-string-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-string-replace-and-transition-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-string-replace-and-transition.html [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-string-slightly-polymorphic-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-string-slightly-polymorphic.html [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-string.html [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-symbol-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-symbol-replace-and-transition-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-symbol-replace-and-transition.html [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-symbol-slightly-polymorphic-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-symbol-slightly-polymorphic.html [new file with mode: 0644]
LayoutTests/js/regress/put-by-val-with-symbol.html [new file with mode: 0644]
LayoutTests/js/regress/script-tests/fold-put-by-val-with-string-to-multi-put-by-offset.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/fold-put-by-val-with-symbol-to-multi-put-by-offset.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/inlined-put-by-val-with-string-transition.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/inlined-put-by-val-with-symbol-transition.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/polymorphic-put-by-val-with-string.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/polymorphic-put-by-val-with-symbol.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/put-by-val-with-string-replace-and-transition.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/put-by-val-with-string-slightly-polymorphic.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/put-by-val-with-string.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/put-by-val-with-symbol-replace-and-transition.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/put-by-val-with-symbol-slightly-polymorphic.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/put-by-val-with-symbol.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/PutByIdStatus.cpp
Source/JavaScriptCore/bytecode/PutByIdStatus.h
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
Source/JavaScriptCore/jit/JIT.h
Source/JavaScriptCore/jit/JITOperations.cpp
Source/JavaScriptCore/jit/JITOperations.h
Source/JavaScriptCore/jit/JITPropertyAccess.cpp
Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
Source/JavaScriptCore/tests/stress/put-by-val-with-string-break.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/put-by-val-with-string-generated.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/put-by-val-with-string-generic.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/put-by-val-with-symbol-break.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/put-by-val-with-symbol-generic.js [new file with mode: 0644]