Ignore:
Timestamp:
Oct 21, 2020, 7:06:02 AM (5 years ago)
Author:
[email protected]
Message:

[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):

  • 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):

  • dfg/DFGNode.h:

(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):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToB3.cpp:

(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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/Repatch.cpp

    r268247 r268794  
    166166    case GetByKind::PrivateName:
    167167        return operationGetPrivateNameOptimize;
     168    case GetByKind::PrivateNameById:
     169        return operationGetPrivateNameByIdOptimize;
    168170    }
    169171    RELEASE_ASSERT_NOT_REACHED();
     
    185187    case GetByKind::PrivateName:
    186188        return operationGetPrivateName;
     189    case GetByKind::PrivateNameById:
     190        return operationGetPrivateNameById;
    187191    }
    188192    RELEASE_ASSERT_NOT_REACHED();
     
    204208            return GiveUpOnCache;
    205209        JSCell* baseCell = baseValue.asCell();
    206         const bool isPrivate = kind == GetByKind::PrivateName;
     210        const bool isPrivate = kind == GetByKind::PrivateName || kind == GetByKind::PrivateNameById;
    207211
    208212        std::unique_ptr<AccessCase> newCase;
Note: See TracChangeset for help on using the changeset viewer.