⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 179912 in webkit


Ignore:
Timestamp:
Feb 10, 2015, 6:41:20 PM (12 years ago)
Author:
fpizlo@apple.com
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.
Location:
trunk/Source/JavaScriptCore
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r179862 r179912  
    844844        ftl/FTLJITFinalizer.cpp
    845845        ftl/FTLJSCall.cpp
     846        ftl/FTLJSCallBase.cpp
    846847        ftl/FTLLink.cpp
    847848        ftl/FTLLocation.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r179898 r179912  
     12015-02-10  Filip Pizlo  <fpizlo@apple.com>
     2
     3        Split FTL::JSCall into the part that knows about call inline caching and the part that interacts with LLVM patchpoints
     4        https://bugs.webkit.org/show_bug.cgi?id=141455
     5
     6        Reviewed by Mark Lam.
     7       
     8        The newly introduced FTL::JSCallBase can be used to build other things, like the FTL portion
     9        of https://bugs.webkit.org/show_bug.cgi?id=141332.
     10
     11        * CMakeLists.txt:
     12        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
     13        * JavaScriptCore.xcodeproj/project.pbxproj:
     14        * bytecode/CallLinkInfo.h:
     15        (JSC::CallLinkInfo::specializationKindFor):
     16        (JSC::CallLinkInfo::specializationKind):
     17        * ftl/FTLJSCall.cpp:
     18        (JSC::FTL::JSCall::JSCall):
     19        (JSC::FTL::JSCall::emit): Deleted.
     20        (JSC::FTL::JSCall::link): Deleted.
     21        * ftl/FTLJSCall.h:
     22        * ftl/FTLJSCallBase.cpp: Added.
     23        (JSC::FTL::JSCallBase::JSCallBase):
     24        (JSC::FTL::JSCallBase::emit):
     25        (JSC::FTL::JSCallBase::link):
     26        * ftl/FTLJSCallBase.h: Added.
     27
    1282015-02-10  Filip Pizlo  <fpizlo@apple.com>
    229
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r179862 r179912  
    511511    <ClCompile Include="..\ftl\FTLJITFinalizer.cpp" />
    512512    <ClCompile Include="..\ftl\FTLJSCall.cpp" />
     513    <ClCompile Include="..\ftl\FTLJSCallBase.cpp" />
    513514    <ClCompile Include="..\ftl\FTLLink.cpp" />
    514515    <ClCompile Include="..\ftl\FTLLocation.cpp" />
     
    11921193    <ClInclude Include="..\ftl\FTLJITFinalizer.h" />
    11931194    <ClInclude Include="..\ftl\FTLJSCall.h" />
     1195    <ClInclude Include="..\ftl\FTLJSCallBase.h" />
    11941196    <ClInclude Include="..\ftl\FTLLink.h" />
    11951197    <ClInclude Include="..\ftl\FTLLocation.h" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r179862 r179912  
    563563                0FCEFADF180738C000472CE4 /* FTLLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FCEFADD180738C000472CE4 /* FTLLocation.cpp */; };
    564564                0FCEFAE0180738C000472CE4 /* FTLLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCEFADE180738C000472CE4 /* FTLLocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
     565                0FD1202F1A8AED12000F5280 /* FTLJSCallBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD1202D1A8AED12000F5280 /* FTLJSCallBase.cpp */; };
     566                0FD120301A8AED12000F5280 /* FTLJSCallBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD1202E1A8AED12000F5280 /* FTLJSCallBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
    565567                0FD2C92416D01EE900C7803F /* StructureInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD2C92316D01EE900C7803F /* StructureInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
    566568                0FD3C82614115D4000FD81CB /* DFGDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD3C82014115CF800FD81CB /* DFGDriver.cpp */; };
     
    22442246                0FCEFADD180738C000472CE4 /* FTLLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLLocation.cpp; path = ftl/FTLLocation.cpp; sourceTree = "<group>"; };
    22452247                0FCEFADE180738C000472CE4 /* FTLLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLLocation.h; path = ftl/FTLLocation.h; sourceTree = "<group>"; };
     2248                0FD1202D1A8AED12000F5280 /* FTLJSCallBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLJSCallBase.cpp; path = ftl/FTLJSCallBase.cpp; sourceTree = "<group>"; };
     2249                0FD1202E1A8AED12000F5280 /* FTLJSCallBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLJSCallBase.h; path = ftl/FTLJSCallBase.h; sourceTree = "<group>"; };
    22462250                0FD2C92316D01EE900C7803F /* StructureInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureInlines.h; sourceTree = "<group>"; };
    22472251                0FD3C82014115CF800FD81CB /* DFGDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGDriver.cpp; path = dfg/DFGDriver.cpp; sourceTree = "<group>"; };
     
    36013605                                0F6B1CB3185FC9E900845D97 /* FTLJSCall.cpp */,
    36023606                                0F6B1CB4185FC9E900845D97 /* FTLJSCall.h */,
     3607                                0FD1202D1A8AED12000F5280 /* FTLJSCallBase.cpp */,
     3608                                0FD1202E1A8AED12000F5280 /* FTLJSCallBase.h */,
    36033609                                0F8F2B93172E049E007DBDA5 /* FTLLink.cpp */,
    36043610                                0F8F2B94172E049E007DBDA5 /* FTLLink.h */,
     
    61306136                                2AAD964A18569417001F93BE /* RecursiveAllocationScope.h in Headers */,
    61316137                                0FF60AC216740F8300029779 /* ReduceWhitespace.h in Headers */,
     6138                                0FD120301A8AED12000F5280 /* FTLJSCallBase.h in Headers */,
    61326139                                0FA7A8EC18B413C80052371D /* Reg.h in Headers */,
    61336140                                BC18C45A0E16F5CD00B34460 /* RegExp.h in Headers */,
     
    72587265                                A54CF2F5184EAB2400237F19 /* ScriptValue.cpp in Sources */,
    72597266                                A7299DA517D12858005F5FF9 /* SetConstructor.cpp in Sources */,
     7267                                0FD1202F1A8AED12000F5280 /* FTLJSCallBase.cpp in Sources */,
    72607268                                A790DD6B182F499700588807 /* SetIteratorConstructor.cpp in Sources */,
    72617269                                A790DD6D182F499700588807 /* SetIteratorPrototype.cpp in Sources */,
  • trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h

    r179478 r179912  
    5656        return CallVarargs;
    5757    }
    58        
     58   
    5959    CallLinkInfo()
    6060        : isFTL(false)
     
    7272    }
    7373   
     74    static CodeSpecializationKind specializationKindFor(CallType callType)
     75    {
     76        return specializationFromIsConstruct(callType == Construct || callType == ConstructVarargs);
     77    }
    7478    CodeSpecializationKind specializationKind() const
    7579    {
    76         return specializationFromIsConstruct(callType == Construct || callType == ConstructVarargs);
     80        return specializationKindFor(static_cast<CallType>(callType));
    7781    }
    7882
  • 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
  • trunk/Source/JavaScriptCore/ftl/FTLJSCall.h

    r170876 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
     
    2929#if ENABLE(FTL_JIT)
    3030
    31 #include "CCallHelpers.h"
    32 #include "CallLinkInfo.h"
    33 #include "CodeOrigin.h"
     31#include "FTLJSCallBase.h"
    3432
    3533namespace JSC {
    36 
    37 class LinkBuffer;
    3834
    3935namespace DFG {
     
    4339namespace FTL {
    4440
    45 class JSCall {
     41class JSCall : public JSCallBase {
    4642public:
    4743    JSCall();
    4844    JSCall(unsigned stackmapID, DFG::Node*);
    49    
    50     void emit(CCallHelpers&);
    51     void link(VM&, LinkBuffer&);
    5245   
    5346    unsigned stackmapID() const { return m_stackmapID; }
     
    6053private:
    6154    unsigned m_stackmapID;
    62     DFG::Node* m_node;
    63     CCallHelpers::DataLabelPtr m_targetToCheck;
    64     CCallHelpers::Call m_fastCall;
    65     CCallHelpers::Call m_slowCall;
    66     CallLinkInfo* m_callLinkInfo;
    6755
    6856public:
Note: See TracChangeset for help on using the changeset viewer.