Ignore:
Timestamp:
Feb 10, 2015, 6:41:20 PM (10 years ago)
Author:
[email protected]
Message:

Split FTL::JSCall into the part that knows about call inline caching and the part that interacts with LLVM patchpoints
https://bugs.webkit.org/show_bug.cgi?id=141455

Reviewed by Mark Lam.

The newly introduced FTL::JSCallBase can be used to build other things, like the FTL portion
of https://bugs.webkit.org/show_bug.cgi?id=141332.

(JSC::CallLinkInfo::specializationKindFor):
(JSC::CallLinkInfo::specializationKind):

  • ftl/FTLJSCall.cpp:

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

  • ftl/FTLJSCall.h:
  • ftl/FTLJSCallBase.cpp: Added.

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

  • ftl/FTLJSCallBase.h: Added.
File:
1 edited

Legend:

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

    r178856 r179912  
    11/*
    2  * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3434namespace JSC { namespace FTL {
    3535
     36using namespace DFG;
     37
    3638JSCall::JSCall()
    3739    : m_stackmapID(UINT_MAX)
    38     , m_node(nullptr)
    39     , m_callLinkInfo(nullptr)
    4040    , m_instructionOffset(UINT_MAX)
    4141{
    4242}
    4343
    44 JSCall::JSCall(unsigned stackmapID, DFG::Node* node)
    45     : m_stackmapID(stackmapID)
    46     , m_node(node)
    47     , m_callLinkInfo(nullptr)
     44JSCall::JSCall(unsigned stackmapID, Node* node)
     45    : JSCallBase(
     46        node->op() == Construct ? CallLinkInfo::Construct : CallLinkInfo::Call,
     47        node->origin.semantic)
     48    , m_stackmapID(stackmapID)
    4849    , m_instructionOffset(0)
    4950{
    50 }
    51 
    52 void JSCall::emit(CCallHelpers& jit)
    53 {
    54     m_callLinkInfo = jit.codeBlock()->addCallLinkInfo();
    55    
    56     CCallHelpers::Jump slowPath = jit.branchPtrWithPatch(
    57         CCallHelpers::NotEqual, GPRInfo::regT0, m_targetToCheck,
    58         CCallHelpers::TrustedImmPtr(0));
    59    
    60     m_fastCall = jit.nearCall();
    61     CCallHelpers::Jump done = jit.jump();
    62    
    63     slowPath.link(&jit);
    64    
    65     jit.move(CCallHelpers::TrustedImmPtr(m_callLinkInfo), GPRInfo::regT2);
    66     m_slowCall = jit.nearCall();
    67    
    68     done.link(&jit);
    69 }
    70 
    71 void JSCall::link(VM& vm, LinkBuffer& linkBuffer)
    72 {
    73     ThunkGenerator generator = linkThunkGeneratorFor(
    74         m_node->op() == DFG::Construct ? CodeForConstruct : CodeForCall,
    75         MustPreserveRegisters);
    76    
    77     linkBuffer.link(
    78         m_slowCall, FunctionPtr(vm.getCTIStub(generator).code().executableAddress()));
    79    
    80     m_callLinkInfo->isFTL = true;
    81     m_callLinkInfo->callType = m_node->op() == DFG::Construct ? CallLinkInfo::Construct : CallLinkInfo::Call;
    82     m_callLinkInfo->codeOrigin = m_node->origin.semantic;
    83     m_callLinkInfo->callReturnLocation = linkBuffer.locationOfNearCall(m_slowCall);
    84     m_callLinkInfo->hotPathBegin = linkBuffer.locationOf(m_targetToCheck);
    85     m_callLinkInfo->hotPathOther = linkBuffer.locationOfNearCall(m_fastCall);
    86     m_callLinkInfo->calleeGPR = GPRInfo::regT0;
    8751}
    8852
Note: See TracChangeset for help on using the changeset viewer.