Ignore:
Timestamp:
Jul 28, 2015, 1:12:33 PM (10 years ago)
Author:
[email protected]
Message:

Simplify call linking
https://bugs.webkit.org/show_bug.cgi?id=147363

Reviewed by Filip Pizlo.

Previously, we were passing both the CallLinkInfo and a
(CodeSpecializationKind, RegisterPreservationMode) pair to the
different call linking slow paths. However, the CallLinkInfo already
has all of that information, and we don't gain anything by having them
in additional static parameters - except possibly a very small
performance gain in presence of inlining. However since those are
already slow paths, this performance loss (if it exists) will not be
visible in practice.

This patch removes the various specialized thunks and JIT operations
for regular and polymorphic call linking with a single thunk and
operation for each case. Moreover, it removes the four specialized
virtual call thunks and operations with one virtual call thunk for each
call link info, allowing for better branch prediction by the CPU and
fixing a pre-existing FIXME.

  • bytecode/CallLinkInfo.cpp:

(JSC::CallLinkInfo::unlink):
(JSC::CallLinkInfo::dummy): Deleted.

  • bytecode/CallLinkInfo.h:

(JSC::CallLinkInfo::CallLinkInfo):
(JSC::CallLinkInfo::registerPreservationMode):
(JSC::CallLinkInfo::setUpCallFromFTL):
(JSC::CallLinkInfo::setSlowStub):
(JSC::CallLinkInfo::clearSlowStub):
(JSC::CallLinkInfo::slowStub):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compileImpl):

  • dfg/DFGJITCompiler.cpp:

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

  • ftl/FTLJSCallBase.cpp:

(JSC::FTL::JSCallBase::link):

  • jit/JITCall.cpp:

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

  • jit/JITCall32_64.cpp:

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

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

(JSC::operationLinkFor): Deleted.
(JSC::operationVirtualFor): Deleted.
(JSC::operationLinkPolymorphicCallFor): Deleted.

  • jit/Repatch.cpp:

(JSC::generateByIdStub):
(JSC::linkSlowFor):
(JSC::linkFor):
(JSC::revertCall):
(JSC::unlinkFor):
(JSC::linkVirtualFor):
(JSC::linkPolymorphicCall):

  • jit/Repatch.h:
  • jit/ThunkGenerators.cpp:

(JSC::linkCallThunkGenerator):
(JSC::linkPolymorphicCallThunkGenerator):
(JSC::virtualThunkFor):
(JSC::linkForThunkGenerator): Deleted.
(JSC::linkConstructThunkGenerator): Deleted.
(JSC::linkCallThatPreservesRegsThunkGenerator): Deleted.
(JSC::linkConstructThatPreservesRegsThunkGenerator): Deleted.
(JSC::linkPolymorphicCallForThunkGenerator): Deleted.
(JSC::linkPolymorphicCallThatPreservesRegsThunkGenerator): Deleted.
(JSC::virtualForThunkGenerator): Deleted.
(JSC::virtualCallThunkGenerator): Deleted.
(JSC::virtualConstructThunkGenerator): Deleted.
(JSC::virtualCallThatPreservesRegsThunkGenerator): Deleted.
(JSC::virtualConstructThatPreservesRegsThunkGenerator): Deleted.

  • jit/ThunkGenerators.h:

(JSC::linkThunkGeneratorFor): Deleted.
(JSC::linkPolymorphicCallThunkGeneratorFor): Deleted.
(JSC::virtualThunkGeneratorFor): Deleted.

File:
1 edited

Legend:

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

    r187351 r187505  
    753753}
    754754
    755 inline char* linkFor(
    756     ExecState* execCallee, CallLinkInfo* callLinkInfo, CodeSpecializationKind kind,
    757     RegisterPreservationMode registers)
     755char* JIT_OPERATION operationLinkCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    758756{
    759757    ExecState* exec = execCallee->callerFrame();
    760758    VM* vm = &exec->vm();
     759    CodeSpecializationKind kind = callLinkInfo->specializationKind();
    761760    NativeCallFrameTracer tracer(vm, exec);
    762761   
     
    777776    CodeBlock* codeBlock = 0;
    778777    if (executable->isHostFunction())
    779         codePtr = executable->entrypointFor(*vm, kind, MustCheckArity, registers);
     778        codePtr = executable->entrypointFor(*vm, kind, MustCheckArity, callLinkInfo->registerPreservationMode());
    780779    else {
    781780        FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
     
    797796        else
    798797            arity = ArityCheckNotRequired;
    799         codePtr = functionExecutable->entrypointFor(*vm, kind, arity, registers);
     798        codePtr = functionExecutable->entrypointFor(*vm, kind, arity, callLinkInfo->registerPreservationMode());
    800799    }
    801800    if (!callLinkInfo->seenOnce())
    802801        callLinkInfo->setSeen();
    803802    else
    804         linkFor(execCallee, *callLinkInfo, codeBlock, callee, codePtr, kind, registers);
     803        linkFor(execCallee, *callLinkInfo, codeBlock, callee, codePtr);
    805804   
    806805    return reinterpret_cast<char*>(codePtr.executableAddress());
    807806}
    808807
    809 char* JIT_OPERATION operationLinkCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    810 {
    811     return linkFor(execCallee, callLinkInfo, CodeForCall, RegisterPreservationNotRequired);
    812 }
    813 
    814 char* JIT_OPERATION operationLinkConstruct(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    815 {
    816     return linkFor(execCallee, callLinkInfo, CodeForConstruct, RegisterPreservationNotRequired);
    817 }
    818 
    819 char* JIT_OPERATION operationLinkCallThatPreservesRegs(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    820 {
    821     return linkFor(execCallee, callLinkInfo, CodeForCall, MustPreserveRegisters);
    822 }
    823 
    824 char* JIT_OPERATION operationLinkConstructThatPreservesRegs(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    825 {
    826     return linkFor(execCallee, callLinkInfo, CodeForConstruct, MustPreserveRegisters);
    827 }
    828 
    829808inline char* virtualForWithFunction(
    830     ExecState* execCallee, CodeSpecializationKind kind, RegisterPreservationMode registers,
    831     JSCell*& calleeAsFunctionCell)
     809    ExecState* execCallee, CallLinkInfo* callLinkInfo, JSCell*& calleeAsFunctionCell)
    832810{
    833811    ExecState* exec = execCallee->callerFrame();
    834812    VM* vm = &exec->vm();
     813    CodeSpecializationKind kind = callLinkInfo->specializationKind();
    835814    NativeCallFrameTracer tracer(vm, exec);
    836815
     
    858837    }
    859838    return reinterpret_cast<char*>(executable->entrypointFor(
    860         *vm, kind, MustCheckArity, registers).executableAddress());
    861 }
    862 
    863 inline char* virtualFor(
    864     ExecState* execCallee, CodeSpecializationKind kind, RegisterPreservationMode registers)
     839        *vm, kind, MustCheckArity, callLinkInfo->registerPreservationMode()).executableAddress());
     840}
     841
     842char* JIT_OPERATION operationLinkPolymorphicCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
     843{
     844    ASSERT(callLinkInfo->specializationKind() == CodeForCall);
     845    JSCell* calleeAsFunctionCell;
     846    char* result = virtualForWithFunction(execCallee, callLinkInfo, calleeAsFunctionCell);
     847
     848    linkPolymorphicCall(execCallee, *callLinkInfo, CallVariant(calleeAsFunctionCell));
     849   
     850    return result;
     851}
     852
     853char* JIT_OPERATION operationVirtualCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    865854{
    866855    JSCell* calleeAsFunctionCellIgnored;
    867     return virtualForWithFunction(execCallee, kind, registers, calleeAsFunctionCellIgnored);
    868 }
    869 
    870 char* JIT_OPERATION operationLinkPolymorphicCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    871 {
    872     JSCell* calleeAsFunctionCell;
    873     char* result = virtualForWithFunction(execCallee, CodeForCall, RegisterPreservationNotRequired, calleeAsFunctionCell);
    874 
    875     linkPolymorphicCall(execCallee, *callLinkInfo, CallVariant(calleeAsFunctionCell), RegisterPreservationNotRequired);
    876    
    877     return result;
    878 }
    879 
    880 char* JIT_OPERATION operationVirtualCall(ExecState* execCallee, CallLinkInfo*)
    881 {   
    882     return virtualFor(execCallee, CodeForCall, RegisterPreservationNotRequired);
    883 }
    884 
    885 char* JIT_OPERATION operationVirtualConstruct(ExecState* execCallee, CallLinkInfo*)
    886 {
    887     return virtualFor(execCallee, CodeForConstruct, RegisterPreservationNotRequired);
    888 }
    889 
    890 char* JIT_OPERATION operationLinkPolymorphicCallThatPreservesRegs(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    891 {
    892     JSCell* calleeAsFunctionCell;
    893     char* result = virtualForWithFunction(execCallee, CodeForCall, MustPreserveRegisters, calleeAsFunctionCell);
    894 
    895     linkPolymorphicCall(execCallee, *callLinkInfo, CallVariant(calleeAsFunctionCell), MustPreserveRegisters);
    896    
    897     return result;
    898 }
    899 
    900 char* JIT_OPERATION operationVirtualCallThatPreservesRegs(ExecState* execCallee, CallLinkInfo*)
    901 {   
    902     return virtualFor(execCallee, CodeForCall, MustPreserveRegisters);
    903 }
    904 
    905 char* JIT_OPERATION operationVirtualConstructThatPreservesRegs(ExecState* execCallee, CallLinkInfo*)
    906 {
    907     return virtualFor(execCallee, CodeForConstruct, MustPreserveRegisters);
     856    return virtualForWithFunction(execCallee, callLinkInfo, calleeAsFunctionCellIgnored);
    908857}
    909858
Note: See TracChangeset for help on using the changeset viewer.