Changeset 229709 in webkit


Ignore:
Timestamp:
Mar 19, 2018 1:22:30 PM (6 years ago)
Author:
mark.lam@apple.com
Message:

FunctionPtr should be passed by value.
https://bugs.webkit.org/show_bug.cgi?id=183746
<rdar://problem/38625311>

Reviewed by JF Bastien.

It's meant to be an encapsulation of a C/C++ function pointer. There are cases
where we use it to pass JIT compiled code (e.g. the VM thunks/stubs), but they are
treated as if they are C/C++ functions.

Regardless, there's no need to pass it by reference.

  • assembler/MacroAssemblerCodeRef.h:
  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::appendCall):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::appendCall):
(JSC::DFG::SpeculativeJIT::appendCallWithCallFrameRollbackOnException):
(JSC::DFG::SpeculativeJIT::appendCallWithCallFrameRollbackOnExceptionSetResult):
(JSC::DFG::SpeculativeJIT::appendCallSetResult):

  • jit/JIT.h:

(JSC::JIT::appendCall):
(JSC::JIT::appendCallWithSlowPathReturnType):

  • jit/JITInlines.h:

(JSC::JIT::appendCallWithExceptionCheck):
(JSC::JIT::appendCallWithExceptionCheckAndSlowPathReturnType):
(JSC::JIT::appendCallWithCallFrameRollbackOnException):
(JSC::JIT::appendCallWithExceptionCheckSetJSValueResult):
(JSC::JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile):

Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r229648 r229709  
     12018-03-19  Mark Lam  <mark.lam@apple.com>
     2
     3        FunctionPtr should be passed by value.
     4        https://bugs.webkit.org/show_bug.cgi?id=183746
     5        <rdar://problem/38625311>
     6
     7        Reviewed by JF Bastien.
     8
     9        It's meant to be an encapsulation of a C/C++ function pointer.  There are cases
     10        where we use it to pass JIT compiled code (e.g. the VM thunks/stubs), but they are
     11        treated as if they are C/C++ functions.
     12
     13        Regardless, there's no need to pass it by reference.
     14
     15        * assembler/MacroAssemblerCodeRef.h:
     16        * dfg/DFGJITCompiler.h:
     17        (JSC::DFG::JITCompiler::appendCall):
     18        * dfg/DFGSpeculativeJIT.h:
     19        (JSC::DFG::SpeculativeJIT::appendCall):
     20        (JSC::DFG::SpeculativeJIT::appendCallWithCallFrameRollbackOnException):
     21        (JSC::DFG::SpeculativeJIT::appendCallWithCallFrameRollbackOnExceptionSetResult):
     22        (JSC::DFG::SpeculativeJIT::appendCallSetResult):
     23        * jit/JIT.h:
     24        (JSC::JIT::appendCall):
     25        (JSC::JIT::appendCallWithSlowPathReturnType):
     26        * jit/JITInlines.h:
     27        (JSC::JIT::appendCallWithExceptionCheck):
     28        (JSC::JIT::appendCallWithExceptionCheckAndSlowPathReturnType):
     29        (JSC::JIT::appendCallWithCallFrameRollbackOnException):
     30        (JSC::JIT::appendCallWithExceptionCheckSetJSValueResult):
     31        (JSC::JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile):
     32
    1332018-03-15  Ross Kirsling  <ross.kirsling@sony.com>
    234
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h

    r229609 r229709  
    127127};
    128128
     129static_assert(sizeof(FunctionPtr) == sizeof(void*), "");
     130static_assert(std::is_trivially_copyable<FunctionPtr>::value, "");
     131
    129132// ReturnAddressPtr:
    130133//
  • trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.h

    r229609 r229709  
    157157
    158158    // Add a call out from JIT code, without an exception check.
    159     Call appendCall(const FunctionPtr& function)
     159    Call appendCall(const FunctionPtr function)
    160160    {
    161161        Call functionCall = call(NoPtrTag);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r229514 r229709  
    10081008
    10091009    // These methods add call instructions, optionally setting results, and optionally rolling back the call frame on an exception.
    1010     JITCompiler::Call appendCall(const FunctionPtr& function)
     1010    JITCompiler::Call appendCall(const FunctionPtr function)
    10111011    {
    10121012        prepareForExternalCall();
     
    10141014        return m_jit.appendCall(function);
    10151015    }
    1016     JITCompiler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr& function)
     1016    JITCompiler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr function)
    10171017    {
    10181018        JITCompiler::Call call = appendCall(function);
     
    10201020        return call;
    10211021    }
    1022     JITCompiler::Call appendCallWithCallFrameRollbackOnExceptionSetResult(const FunctionPtr& function, GPRReg result)
     1022    JITCompiler::Call appendCallWithCallFrameRollbackOnExceptionSetResult(const FunctionPtr function, GPRReg result)
    10231023    {
    10241024        JITCompiler::Call call = appendCallWithCallFrameRollbackOnException(function);
     
    10271027        return call;
    10281028    }
    1029     JITCompiler::Call appendCallSetResult(const FunctionPtr& function, GPRReg result)
     1029    JITCompiler::Call appendCallSetResult(const FunctionPtr function, GPRReg result)
    10301030    {
    10311031        JITCompiler::Call call = appendCall(function);
     
    10341034        return call;
    10351035    }
    1036     JITCompiler::Call appendCallSetResult(const FunctionPtr& function, GPRReg result1, GPRReg result2)
     1036    JITCompiler::Call appendCallSetResult(const FunctionPtr function, GPRReg result1, GPRReg result2)
    10371037    {
    10381038        JITCompiler::Call call = appendCall(function);
     
    10401040        return call;
    10411041    }
    1042     JITCompiler::Call appendCallSetResult(const FunctionPtr& function, JSValueRegs resultRegs)
     1042    JITCompiler::Call appendCallSetResult(const FunctionPtr function, JSValueRegs resultRegs)
    10431043    {
    10441044#if USE(JSVALUE64)
     
    10491049    }
    10501050#if CPU(X86)
    1051     JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
     1051    JITCompiler::Call appendCallSetResult(const FunctionPtr function, FPRReg result)
    10521052    {
    10531053        JITCompiler::Call call = appendCall(function);
     
    10591059    }
    10601060#elif CPU(ARM) && !CPU(ARM_HARDFP)
    1061     JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
     1061    JITCompiler::Call appendCallSetResult(const FunctionPtr function, FPRReg result)
    10621062    {
    10631063        JITCompiler::Call call = appendCall(function);
     
    10671067    }
    10681068#else // CPU(X86_64) || (CPU(ARM) && CPU(ARM_HARDFP)) || CPU(ARM64) || CPU(MIPS)
    1069     JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result)
     1069    JITCompiler::Call appendCallSetResult(const FunctionPtr function, FPRReg result)
    10701070    {
    10711071        JITCompiler::Call call = appendCall(function);
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r229609 r229709  
    268268
    269269        // Add a call out from JIT code, without an exception check.
    270         Call appendCall(const FunctionPtr& function)
     270        Call appendCall(const FunctionPtr function)
    271271        {
    272272            Call functionCall = call(NoPtrTag);
     
    276276
    277277#if OS(WINDOWS) && CPU(X86_64)
    278         Call appendCallWithSlowPathReturnType(const FunctionPtr& function)
     278        Call appendCallWithSlowPathReturnType(const FunctionPtr function)
    279279        {
    280280            Call functionCall = callWithSlowPathReturnType();
     
    705705        }
    706706
    707         MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr&);
     707        MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr);
    708708#if OS(WINDOWS) && CPU(X86_64)
    709         MacroAssembler::Call appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr&);
    710 #endif
    711         MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr&);
    712         MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr&, int);
    713         MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResultWithProfile(const FunctionPtr&, int);
     709        MacroAssembler::Call appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr);
     710#endif
     711        MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr);
     712        MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr, int);
     713        MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResultWithProfile(const FunctionPtr, int);
    714714       
    715715        template<typename OperationType, typename... Args>
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r229391 r229709  
    150150}
    151151
    152 ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheck(const FunctionPtr& function)
     152ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheck(const FunctionPtr function)
    153153{
    154154    updateTopCallFrame();
     
    159159
    160160#if OS(WINDOWS) && CPU(X86_64)
    161 ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr& function)
     161ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr function)
    162162{
    163163    updateTopCallFrame();
     
    168168#endif
    169169
    170 ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithCallFrameRollbackOnException(const FunctionPtr& function)
     170ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithCallFrameRollbackOnException(const FunctionPtr function)
    171171{
    172172    updateTopCallFrame(); // The callee is responsible for setting topCallFrame to their caller
     
    176176}
    177177
    178 ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr& function, int dst)
     178ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr function, int dst)
    179179{
    180180    MacroAssembler::Call call = appendCallWithExceptionCheck(function);
     
    187187}
    188188
    189 ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile(const FunctionPtr& function, int dst)
     189ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile(const FunctionPtr function, int dst)
    190190{
    191191    MacroAssembler::Call call = appendCallWithExceptionCheck(function);
Note: See TracChangeset for help on using the changeset viewer.