[JSC] support op_get_private_name in DFG and FTL
https://bugs.webkit.org/show_bug.cgi?id=214861
Reviewed by Filip Pizlo.
JSTests:
- microbenchmarks/class-fields-private/monomorphic-get-private-field.js: Added.
- microbenchmarks/class-fields-private/polymorphic-get-private-field.js: Added.
- stress/dfg-get-private-name-by-id-generic.js: Added.
- stress/dfg-get-private-name-by-id-osr-bad-identifier.js: Added.
- stress/dfg-get-private-name-by-id.js: Added.
- stress/dfg-get-private-name-by-offset-osr-bad-identifier.js: Added.
- stress/dfg-get-private-name-by-offset-osr-bad-structure.js: Added.
- stress/dfg-get-private-name-by-offset.js: Added.
- stress/dfg-get-private-name-by-val-generic.js: Added.
- stress/ftl-get-private-name-by-id.js: Added.
- stress/ftl-get-private-name-by-offset-multi.js: Added.
- stress/get-private-name-with-constant-ident.js: Added.
- stress/get-private-name-with-constant-symbol.js: Added.
- stress/get-private-name-with-different-symbol.js: Added.
Source/JavaScriptCore:
Adds DFG/FTL support for op_get_private_name.
During DFG bytecode parsing, we will attempt, if deemed possible by
the information available, to output a GetByOffset operation. If a
single private field identifier is used in all cases (the common case),
but there are too many structure variants, a GetPrivateNameById
operation is emitted instead. Failing that, the GetPrivateName
operation is produced, which produces a GetByVal IC like in the
baseline JIT.
In FTL, GetPrivateNameByID can be reduced to [Multi]GetByOffset in the
DFGConstantFoldingPhase, or a GetByID IC when lowering to B3.
- bytecode/GetByStatus.cpp:
(JSC::GetByStatus::computeFromLLInt):
- bytecode/StructureStubInfo.h:
(JSC::appropriateOptimizingGetByIdFunction):
(JSC::appropriateGenericGetByIdFunction):
- dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
- dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::simplifyGetByStatus):
(JSC::DFG::ByteCodeParser::handleGetById):
(JSC::DFG::ByteCodeParser::handleGetPrivateNameById):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::clobberize):
- dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
(JSC::DFG::doesGC):
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::Node::convertToGetByOffset):
(JSC::DFG::Node::convertToMultiGetByOffset):
(JSC::DFG::Node::hasCacheableIdentifier):
(JSC::DFG::Node::hasHeapPrediction):
- dfg/DFGNodeType.h:
- dfg/DFGPredictionPropagationPhase.cpp:
- dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
- dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileGetPrivateName):
(JSC::DFG::SpeculativeJIT::compileGetPrivateNameByVal):
(JSC::DFG::SpeculativeJIT::compileGetPrivateNameById):
- dfg/DFGSpeculativeJIT.h:
- dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
- dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
(JSC::FTL::canCompile):
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::getPrivateName):
(JSC::FTL::DFG::LowerDFGToB3::compileGetPrivateName):
(JSC::FTL::DFG::LowerDFGToB3::compileGetPrivateNameById):
- jit/ICStats.h:
- jit/JITOperations.cpp:
(JSC::getPrivateName):
(JSC::JSC_DEFINE_JIT_OPERATION):
- jit/JITOperations.h:
- jit/Repatch.cpp:
(JSC::appropriateOptimizingGetByFunction):
(JSC::appropriateGetByFunction):
(JSC::tryCacheGetBy):
- jit/Repatch.h:
- runtime/OptionsList.h: