Ignore:
Timestamp:
Mar 22, 2014, 9:34:38 PM (11 years ago)
Author:
[email protected]
Message:

Call linking slow paths should be passed a CallLinkInfo* directly so that you can create a call IC without adding it to any CodeBlocks
https://bugs.webkit.org/show_bug.cgi?id=130644

Reviewed by Andreas Kling.

This is conceptually a really simple change but it involves the following:

  • The inline part of the call IC stuffs a pointer to the CallLinkInfo into regT2.


  • CodeBlock uses a Bag of CallLinkInfos instead of a Vector.


  • Remove the significance of a CallLinkInfo's index. This means that DFG::JITCode no longer has a vector of slow path counts that shadows the CallLinkInfo vector.


  • Make CallLinkInfo have its own slowPathCount, which counts actual slow path executions and not all relinking.


This makes planting JS->JS calls inside other inline caches or stubs a lot easier, since
the CallLinkInfo and the call IC slow paths no longer rely on the call being associated
with a op_call/op_construct instruction and a machine code return PC within such an
instruction.

  • bytecode/CallLinkInfo.h:

(JSC::getCallLinkInfoCodeOrigin):

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFor):
(JSC::CallLinkStatus::computeDFGStatuses):

  • bytecode/CallLinkStatus.h:
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::printCallOp):
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::getCallLinkInfoMap):
(JSC::CodeBlock::getCallLinkInfoForBytecodeIndex):
(JSC::CodeBlock::addCallLinkInfo):
(JSC::CodeBlock::unlinkCalls):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::stubInfoBegin):
(JSC::CodeBlock::stubInfoEnd):
(JSC::CodeBlock::callLinkInfosBegin):
(JSC::CodeBlock::callLinkInfosEnd):
(JSC::CodeBlock::byValInfo):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGJITCode.h:
  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::addJSCall):
(JSC::DFG::JITCompiler::JSCallRecord::JSCallRecord):

  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::reifyInlinedCallFrames):

  • dfg/DFGSpeculativeJIT.cpp:

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

  • dfg/DFGSpeculativeJIT.h:
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::emitCall):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::emitCall):

  • ftl/FTLCompile.cpp:

(JSC::FTL::fixFunctionBasedOnStackMaps):

  • ftl/FTLInlineCacheSize.cpp:

(JSC::FTL::sizeOfCall):

  • ftl/FTLJSCall.cpp:

(JSC::FTL::JSCall::JSCall):
(JSC::FTL::JSCall::emit):
(JSC::FTL::JSCall::link):

  • ftl/FTLJSCall.h:
  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
(JSC::JIT::privateCompile):

  • jit/JIT.h:
  • jit/JITCall.cpp:

(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):

  • jit/JITCall32_64.cpp:

(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):

  • jit/JITOperations.cpp:
  • jit/JITOperations.h:

(JSC::operationLinkFor):
(JSC::operationVirtualFor):
(JSC::operationLinkClosureCallFor):

  • jit/Repatch.cpp:

(JSC::linkClosureCall):

  • jit/ThunkGenerators.cpp:

(JSC::slowPathFor):
(JSC::virtualForThunkGenerator):

  • tests/stress/eval-that-is-not-eval.js: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ftl/FTLJSCall.cpp

    r163946 r166135  
    3535JSCall::JSCall()
    3636    : m_stackmapID(UINT_MAX)
    37     , m_node(0)
     37    , m_node(nullptr)
     38    , m_callLinkInfo(nullptr)
    3839    , m_instructionOffset(UINT_MAX)
    3940{
     
    4344    : m_stackmapID(stackmapID)
    4445    , m_node(node)
     46    , m_callLinkInfo(nullptr)
    4547    , m_instructionOffset(0)
    4648{
     
    4951void JSCall::emit(CCallHelpers& jit)
    5052{
     53    m_callLinkInfo = jit.codeBlock()->addCallLinkInfo();
     54   
    5155    CCallHelpers::Jump slowPath = jit.branchPtrWithPatch(
    5256        CCallHelpers::NotEqual, GPRInfo::regT0, m_targetToCheck,
     
    6670   
    6771    slowPath.link(&jit);
     72   
     73    jit.move(CCallHelpers::TrustedImmPtr(m_callLinkInfo), GPRInfo::regT2);
    6874    m_slowCall = jit.nearCall();
    6975   
     
    7177}
    7278
    73 void JSCall::link(VM& vm, LinkBuffer& linkBuffer, CallLinkInfo& callInfo)
     79void JSCall::link(VM& vm, LinkBuffer& linkBuffer)
    7480{
    7581    ThunkGenerator generator = linkThunkGeneratorFor(
     
    8086        m_slowCall, FunctionPtr(vm.getCTIStub(generator).code().executableAddress()));
    8187   
    82     callInfo.isFTL = true;
    83     callInfo.callType = m_node->op() == DFG::Construct ? CallLinkInfo::Construct : CallLinkInfo::Call;
    84     callInfo.codeOrigin = m_node->origin.semantic;
    85     callInfo.callReturnLocation = linkBuffer.locationOfNearCall(m_slowCall);
    86     callInfo.hotPathBegin = linkBuffer.locationOf(m_targetToCheck);
    87     callInfo.hotPathOther = linkBuffer.locationOfNearCall(m_fastCall);
    88     callInfo.calleeGPR = GPRInfo::regT0;
     88    m_callLinkInfo->isFTL = true;
     89    m_callLinkInfo->callType = m_node->op() == DFG::Construct ? CallLinkInfo::Construct : CallLinkInfo::Call;
     90    m_callLinkInfo->codeOrigin = m_node->origin.semantic;
     91    m_callLinkInfo->callReturnLocation = linkBuffer.locationOfNearCall(m_slowCall);
     92    m_callLinkInfo->hotPathBegin = linkBuffer.locationOf(m_targetToCheck);
     93    m_callLinkInfo->hotPathOther = linkBuffer.locationOfNearCall(m_fastCall);
     94    m_callLinkInfo->calleeGPR = GPRInfo::regT0;
    8995}
    9096
Note: See TracChangeset for help on using the changeset viewer.