Ignore:
Timestamp:
Feb 16, 2014, 10:35:32 PM (11 years ago)
Author:
[email protected]
Message:

FTL should inline polymorphic heap accesses
https://bugs.webkit.org/show_bug.cgi?id=128795

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

We now inline GetByIds that we know are pure but polymorphic. They manifest in DFG IR
as MultiGetByOffset, and in LLVM IR as a switch with a basic block for each kind of
read.

2% speed-up on Octane mostly due to a 18% speed-up on deltablue.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):

  • bytecode/ExitingJITType.cpp: Added.

(WTF::printInternal):

  • bytecode/ExitingJITType.h:
  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFromLLInt):
(JSC::GetByIdStatus::computeForChain):
(JSC::GetByIdStatus::computeForStubInfo):
(JSC::GetByIdStatus::computeFor):
(JSC::GetByIdStatus::dump):

  • bytecode/GetByIdStatus.h:

(JSC::GetByIdStatus::GetByIdStatus):
(JSC::GetByIdStatus::numVariants):
(JSC::GetByIdStatus::variants):
(JSC::GetByIdStatus::at):
(JSC::GetByIdStatus::operator[]):

  • bytecode/GetByIdVariant.cpp: Added.

(JSC::GetByIdVariant::dump):
(JSC::GetByIdVariant::dumpInContext):

  • bytecode/GetByIdVariant.h: Added.

(JSC::GetByIdVariant::GetByIdVariant):
(JSC::GetByIdVariant::isSet):
(JSC::GetByIdVariant::operator!):
(JSC::GetByIdVariant::structureSet):
(JSC::GetByIdVariant::chain):
(JSC::GetByIdVariant::specificValue):
(JSC::GetByIdVariant::offset):

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::emitPrototypeChecks):
(JSC::DFG::ByteCodeParser::handleGetById):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::getByOffsetLoadElimination):
(JSC::DFG::CSEPhase::performNodeCSE):

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGCommon.h:

(JSC::DFG::verboseCompilationEnabled):
(JSC::DFG::logCompilationChanges):
(JSC::DFG::shouldShowDisassembly):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):
(JSC::DFG::ConstantFoldingPhase::emitGetByOffset):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compileImpl):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::convertToConstant):

  • dfg/DFGNode.h:

(JSC::DFG::Node::convertToGetByOffset):
(JSC::DFG::Node::hasHeapPrediction):
(JSC::DFG::Node::hasMultiGetByOffsetData):
(JSC::DFG::Node::multiGetByOffsetData):

  • dfg/DFGNodeType.h:
  • dfg/DFGPhase.h:

(JSC::DFG::Phase::graph):
(JSC::DFG::runAndLog):

  • dfg/DFGPlan.cpp:

(JSC::DFG::dumpAndVerifyGraph):
(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::compileInThreadImpl):

  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSafeToExecute.h:

(JSC::DFG::safeToExecute):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGTypeCheckHoistingPhase.cpp:

(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantStructureChecks):
(JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLCompile.cpp:

(JSC::FTL::fixFunctionBasedOnStackMaps):
(JSC::FTL::compile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileMultiGetByOffset):

  • ftl/FTLState.h:

(JSC::FTL::verboseCompilationEnabled):
(JSC::FTL::showDisassembly):

  • jsc.cpp:

(GlobalObject::finishCreation):
(functionEffectful42):

  • runtime/IntendedStructureChain.cpp:

(JSC::IntendedStructureChain::dump):
(JSC::IntendedStructureChain::dumpInContext):

  • runtime/IntendedStructureChain.h:
  • runtime/Options.cpp:

(JSC::recomputeDependentOptions):

  • runtime/Options.h:
  • tests/stress/fold-multi-get-by-offset-to-get-by-offset-with-watchpoint.js: Added.

(foo):
(bar):

  • tests/stress/fold-multi-get-by-offset-to-get-by-offset.js: Added.

(foo):
(bar):

  • tests/stress/multi-get-by-offset-proto-and-self.js: Added.

(foo):
(Foo):

Source/WTF:

Reviewed by Oliver Hunt.

  • wtf/PrintStream.h:

(WTF::PointerDumpInContext::PointerDumpInContext):
(WTF::PointerDumpInContext::dump):
(WTF::pointerDumpInContext):

LayoutTests:

Reviewed by Oliver Hunt.

  • js/regress/polymorphic-get-by-id-expected.txt: Added.
  • js/regress/polymorphic-get-by-id.html: Added.
  • js/regress/script-tests/polymorphic-get-by-id.js: Added.

(foo):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r164059 r164207  
    239239static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*);
    240240static EncodedJSValue JSC_HOST_CALL functionFalse(ExecState*);
     241static EncodedJSValue JSC_HOST_CALL functionEffectful42(ExecState*);
    241242
    242243#if ENABLE(SAMPLING_FLAGS)
     
    374375        putDirectNativeFunction(vm, this, Identifier(&vm, "DFGTrue"), 0, functionFalse, DFGTrue, DontEnum | JSC::Function);
    375376       
     377        addFunction(vm, "effectful42", functionEffectful42, 0);
     378       
    376379        JSArray* array = constructEmptyArray(globalExec(), 0);
    377380        for (size_t i = 0; i < arguments.size(); ++i)
     
    726729{
    727730    return JSValue::encode(jsBoolean(false));
     731}
     732
     733EncodedJSValue JSC_HOST_CALL functionEffectful42(ExecState*)
     734{
     735    return JSValue::encode(jsNumber(42));
    728736}
    729737
Note: See TracChangeset for help on using the changeset viewer.