Introduce get_by_id like IC into get_by_val when the given name is String or Symbol
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Aug 2015 02:08:07 +0000 (02:08 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Aug 2015 02:08:07 +0000 (02:08 +0000)
commit5823ee24ff89c43489e1a1bd63501fccb75b862a
tree857ba68c64d2e14a2448234f9b042236fc7f13a6
parent1173b97c229d44e5055dd49c3956039c720d2cea
Introduce get_by_id like IC into get_by_val when the given name is String or Symbol
https://bugs.webkit.org/show_bug.cgi?id=147480

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

This patch adds get_by_id IC to get_by_val operation by caching the string / symbol id.
The IC site only caches one id. After checking that the given id is the same to the
cached one, we perform the get_by_id IC onto it.
And by collecting IC StructureStubInfo information, we pass it to the DFG and DFG
compiles get_by_val op code into CheckIdent (with edge type check) and GetById related
operations when the given get_by_val leverages the property load with the cached id.

To ensure the incoming value is the expected id, in DFG layer, we use SymbolUse and
StringIdentUse to enforce the type. To use it, this patch implements SymbolUse.
This can be leveraged to optimize symbol operations in DFG.

And since byValInfo is frequently used, we align the byValInfo design to the stubInfo like one.
Allocated by the Bag and operations take the raw byValInfo pointer directly instead of performing
binary search onto m_byValInfos. And by storing ArrayProfile* under the ByValInfo, we replaced the
argument ArrayProfile* in the operations with ByValInfo*.

* bytecode/ByValInfo.h:
(JSC::ByValInfo::ByValInfo):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::getByValInfoMap):
(JSC::CodeBlock::addByValInfo):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::getByValInfo): Deleted.
(JSC::CodeBlock::setNumberOfByValInfos): Deleted.
(JSC::CodeBlock::numberOfByValInfos): Deleted.
(JSC::CodeBlock::byValInfo): Deleted.
* bytecode/ExitKind.cpp:
(JSC::exitKindToString):
* bytecode/ExitKind.h:
* bytecode/GetByIdStatus.cpp:
(JSC::GetByIdStatus::computeFor):
(JSC::GetByIdStatus::computeForStubInfo):
(JSC::GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback):
* bytecode/GetByIdStatus.h:
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::observeUseKindOnNode):
* dfg/DFGNode.h:
(JSC::DFG::Node::hasUidOperand):
(JSC::DFG::Node::uidOperand):
* dfg/DFGNodeType.h:
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate):
* dfg/DFGSafeToExecute.h:
(JSC::DFG::SafeToExecuteEdge::operator()):
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileCheckIdent):
(JSC::DFG::SpeculativeJIT::speculateSymbol):
(JSC::DFG::SpeculativeJIT::speculate):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGUseKind.cpp:
(WTF::printInternal):
* dfg/DFGUseKind.h:
(JSC::DFG::typeFilterFor):
(JSC::DFG::isCell):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::DFG::LowerDFGToLLVM::compileNode):
(JSC::FTL::DFG::LowerDFGToLLVM::compileCheckIdent):
(JSC::FTL::DFG::LowerDFGToLLVM::lowSymbol):
(JSC::FTL::DFG::LowerDFGToLLVM::speculate):
(JSC::FTL::DFG::LowerDFGToLLVM::isNotSymbol):
(JSC::FTL::DFG::LowerDFGToLLVM::speculateSymbol):
* jit/JIT.cpp:
(JSC::JIT::privateCompile):
* jit/JIT.h:
(JSC::ByValCompilationInfo::ByValCompilationInfo):
(JSC::JIT::compileGetByValWithCachedId):
* jit/JITInlines.h:
(JSC::JIT::callOperation):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_has_indexed_property):
(JSC::JIT::emitSlow_op_has_indexed_property):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_has_indexed_property):
(JSC::JIT::emitSlow_op_has_indexed_property):
* jit/JITOperations.cpp:
(JSC::getByVal):
* jit/JITOperations.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitGetByValWithCachedId):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitSlow_op_put_by_val):
(JSC::JIT::privateCompileGetByVal):
(JSC::JIT::privateCompileGetByValWithCachedId):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitGetByValWithCachedId):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitSlow_op_put_by_val):
* runtime/Symbol.h:
* tests/stress/get-by-val-with-string-constructor.js: Added.
(Hello):
(get Hello.prototype.generate):
(ok):
* tests/stress/get-by-val-with-string-exit.js: Added.
(shouldBe):
(getByVal):
(getStr1):
(getStr2):
* tests/stress/get-by-val-with-string-generated.js: Added.
(shouldBe):
(getByVal):
(getStr1):
(getStr2):
* tests/stress/get-by-val-with-string-getter.js: Added.
(object.get hello):
(ok):
* tests/stress/get-by-val-with-string.js: Added.
(shouldBe):
(getByVal):
(getStr1):
(getStr2):
* tests/stress/get-by-val-with-symbol-constructor.js: Added.
(Hello):
(get Hello.prototype.generate):
(ok):
* tests/stress/get-by-val-with-symbol-exit.js: Added.
(shouldBe):
(getByVal):
(getSym1):
(getSym2):
* tests/stress/get-by-val-with-symbol-getter.js: Added.
(object.get hello):
(.get ok):
* tests/stress/get-by-val-with-symbol.js: Added.
(shouldBe):
(getByVal):
(getSym1):
(getSym2):

LayoutTests:

Add synthetic benchmarks that replaces normal property load with symbol/string keyed load.

* js/regress/get-by-val-with-string-bimorphic-check-structure-elimination-expected.txt: Added.
* js/regress/get-by-val-with-string-bimorphic-check-structure-elimination-simple-expected.txt: Added.
* js/regress/get-by-val-with-string-bimorphic-check-structure-elimination-simple.html: Added.
* js/regress/get-by-val-with-string-bimorphic-check-structure-elimination.html: Added.
* js/regress/get-by-val-with-string-chain-from-try-block-expected.txt: Added.
* js/regress/get-by-val-with-string-chain-from-try-block.html: Added.
* js/regress/get-by-val-with-string-check-structure-elimination-expected.txt: Added.
* js/regress/get-by-val-with-string-check-structure-elimination.html: Added.
* js/regress/get-by-val-with-string-proto-or-self-expected.txt: Added.
* js/regress/get-by-val-with-string-proto-or-self.html: Added.
* js/regress/get-by-val-with-string-quadmorphic-check-structure-elimination-simple-expected.txt: Added.
* js/regress/get-by-val-with-string-quadmorphic-check-structure-elimination-simple.html: Added.
* js/regress/get-by-val-with-string-self-or-proto-expected.txt: Added.
* js/regress/get-by-val-with-string-self-or-proto.html: Added.
* js/regress/get-by-val-with-symbol-bimorphic-check-structure-elimination-expected.txt: Added.
* js/regress/get-by-val-with-symbol-bimorphic-check-structure-elimination-simple-expected.txt: Added.
* js/regress/get-by-val-with-symbol-bimorphic-check-structure-elimination-simple.html: Added.
* js/regress/get-by-val-with-symbol-bimorphic-check-structure-elimination.html: Added.
* js/regress/get-by-val-with-symbol-chain-from-try-block-expected.txt: Added.
* js/regress/get-by-val-with-symbol-chain-from-try-block.html: Added.
* js/regress/get-by-val-with-symbol-check-structure-elimination-expected.txt: Added.
* js/regress/get-by-val-with-symbol-check-structure-elimination.html: Added.
* js/regress/get-by-val-with-symbol-proto-or-self-expected.txt: Added.
* js/regress/get-by-val-with-symbol-proto-or-self.html: Added.
* js/regress/get-by-val-with-symbol-quadmorphic-check-structure-elimination-simple-expected.txt: Added.
* js/regress/get-by-val-with-symbol-quadmorphic-check-structure-elimination-simple.html: Added.
* js/regress/get-by-val-with-symbol-self-or-proto-expected.txt: Added.
* js/regress/get-by-val-with-symbol-self-or-proto.html: Added.
* js/regress/script-tests/get-by-val-with-string-bimorphic-check-structure-elimination-simple.js: Added.
* js/regress/script-tests/get-by-val-with-string-bimorphic-check-structure-elimination.js: Added.
* js/regress/script-tests/get-by-val-with-string-chain-from-try-block.js: Added.
(A):
(B):
(C):
(D):
(E):
(F):
(G):
(foo):
* js/regress/script-tests/get-by-val-with-string-check-structure-elimination.js: Added.
* js/regress/script-tests/get-by-val-with-string-proto-or-self.js: Added.
(foo):
(bar):
(Foo):
* js/regress/script-tests/get-by-val-with-string-quadmorphic-check-structure-elimination-simple.js: Added.
* js/regress/script-tests/get-by-val-with-string-self-or-proto.js: Added.
(foo):
(bar):
(Foo):
* js/regress/script-tests/get-by-val-with-symbol-bimorphic-check-structure-elimination-simple.js: Added.
* js/regress/script-tests/get-by-val-with-symbol-bimorphic-check-structure-elimination.js: Added.
* js/regress/script-tests/get-by-val-with-symbol-chain-from-try-block.js: Added.
(A):
(B):
(C):
(D):
(E):
(F):
(G):
(foo):
* js/regress/script-tests/get-by-val-with-symbol-check-structure-elimination.js: Added.
* js/regress/script-tests/get-by-val-with-symbol-proto-or-self.js: Added.
(foo):
(bar):
(Foo):
* js/regress/script-tests/get-by-val-with-symbol-quadmorphic-check-structure-elimination-simple.js: Added.
* js/regress/script-tests/get-by-val-with-symbol-self-or-proto.js: Added.
(foo):
(bar):
(Foo):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
89 files changed:
LayoutTests/ChangeLog
LayoutTests/js/regress/get-by-val-with-string-bimorphic-check-structure-elimination-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-bimorphic-check-structure-elimination-simple-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-bimorphic-check-structure-elimination-simple.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-bimorphic-check-structure-elimination.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-chain-from-try-block-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-chain-from-try-block.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-check-structure-elimination-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-check-structure-elimination.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-proto-or-self-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-proto-or-self.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-quadmorphic-check-structure-elimination-simple-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-quadmorphic-check-structure-elimination-simple.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-self-or-proto-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-string-self-or-proto.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-bimorphic-check-structure-elimination-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-bimorphic-check-structure-elimination-simple-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-bimorphic-check-structure-elimination-simple.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-bimorphic-check-structure-elimination.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-chain-from-try-block-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-chain-from-try-block.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-check-structure-elimination-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-check-structure-elimination.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-proto-or-self-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-proto-or-self.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-quadmorphic-check-structure-elimination-simple-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-quadmorphic-check-structure-elimination-simple.html [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-self-or-proto-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/get-by-val-with-symbol-self-or-proto.html [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-string-bimorphic-check-structure-elimination-simple.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-string-bimorphic-check-structure-elimination.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-string-chain-from-try-block.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-string-check-structure-elimination.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-string-proto-or-self.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-string-quadmorphic-check-structure-elimination-simple.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-string-self-or-proto.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-symbol-bimorphic-check-structure-elimination-simple.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-symbol-bimorphic-check-structure-elimination.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-symbol-chain-from-try-block.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-symbol-check-structure-elimination.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-symbol-proto-or-self.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-symbol-quadmorphic-check-structure-elimination-simple.js [new file with mode: 0644]
LayoutTests/js/regress/script-tests/get-by-val-with-symbol-self-or-proto.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/ByValInfo.h
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/bytecode/CodeBlock.h
Source/JavaScriptCore/bytecode/ExitKind.cpp
Source/JavaScriptCore/bytecode/ExitKind.h
Source/JavaScriptCore/bytecode/GetByIdStatus.cpp
Source/JavaScriptCore/bytecode/GetByIdStatus.h
Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
Source/JavaScriptCore/dfg/DFGClobberize.h
Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
Source/JavaScriptCore/dfg/DFGDoesGC.cpp
Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
Source/JavaScriptCore/dfg/DFGNode.h
Source/JavaScriptCore/dfg/DFGNodeType.h
Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
Source/JavaScriptCore/dfg/DFGSafeToExecute.h
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
Source/JavaScriptCore/dfg/DFGUseKind.cpp
Source/JavaScriptCore/dfg/DFGUseKind.h
Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.h
Source/JavaScriptCore/ftl/FTLCapabilities.cpp
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
Source/JavaScriptCore/jit/JIT.cpp
Source/JavaScriptCore/jit/JIT.h
Source/JavaScriptCore/jit/JITInlines.h
Source/JavaScriptCore/jit/JITOpcodes.cpp
Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
Source/JavaScriptCore/jit/JITOperations.cpp
Source/JavaScriptCore/jit/JITOperations.h
Source/JavaScriptCore/jit/JITPropertyAccess.cpp
Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
Source/JavaScriptCore/runtime/Symbol.h
Source/JavaScriptCore/tests/stress/get-by-val-with-string-constructor.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/get-by-val-with-string-exit.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/get-by-val-with-string-generated.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/get-by-val-with-string-getter.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/get-by-val-with-string.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/get-by-val-with-symbol-constructor.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/get-by-val-with-symbol-exit.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/get-by-val-with-symbol-getter.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/get-by-val-with-symbol.js [new file with mode: 0644]