Ignore:
Timestamp:
May 23, 2012, 1:52:42 PM (13 years ago)
Author:
[email protected]
Message:

DFG should be able to inline functions that use arguments reflectively
https://bugs.webkit.org/show_bug.cgi?id=86132

Reviewed by Oliver Hunt.

Merged r116838 from dfgopt.

This turns on inlining of functions that use arguments reflectively, but it
does not do any of the obvious optimizations that this exposes. I'll save that
for another patch - the important thing for now is that this contains all of
the plumbing necessary to make this kind of inlining sound even in bizarro
cases like an inline callee escaping the arguments object to parts of the
inline caller where the arguments are otherwise dead. Or even more fun cases
like where you've inlined to an inline stack that is three-deep, and the
function on top of the inline stack reflectively accesses the arguments of a
function that is in the middle of the inline stack. Any subsequent
optimizations that we do for the obvious cases of arguments usage in inline
functions will have to take care not to break the baseline functionality that
this patch plumbs together.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::printCallOp):
(JSC::CodeBlock::dump):

  • bytecode/CodeBlock.h:
  • dfg/DFGAssemblyHelpers.h:

(JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
(AssemblyHelpers):

  • dfg/DFGByteCodeParser.cpp:

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

  • dfg/DFGCCallHelpers.h:

(JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
(CCallHelpers):

  • dfg/DFGCapabilities.h:

(JSC::DFG::canInlineOpcode):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

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

(JSC::DFG::SpeculativeJIT::callOperation):

  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

  • interpreter/CallFrame.cpp:

(JSC):
(JSC::CallFrame::someCodeBlockForPossiblyInlinedCode):

  • interpreter/CallFrame.h:

(ExecState):
(JSC::ExecState::someCodeBlockForPossiblyInlinedCode):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::retrieveArgumentsFromVMCode):

  • runtime/Arguments.cpp:

(JSC::Arguments::tearOff):
(JSC):
(JSC::Arguments::tearOffForInlineCallFrame):

  • runtime/Arguments.h:

(Arguments):
(JSC::Arguments::create):
(JSC::Arguments::finishCreation):
(JSC):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGCCallHelpers.h

    r118030 r118240  
    116116    }
    117117
     118    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1)
     119    {
     120        resetCallArguments();
     121        addCallArgument(GPRInfo::callFrameRegister);
     122        addCallArgument(arg1);
     123    }
     124
    118125    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2)
    119126    {
     
    133140
    134141    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2)
     142    {
     143        resetCallArguments();
     144        addCallArgument(GPRInfo::callFrameRegister);
     145        addCallArgument(arg1);
     146        addCallArgument(arg2);
     147    }
     148
     149    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2)
    135150    {
    136151        resetCallArguments();
     
    428443    }
    429444
     445    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1)
     446    {
     447        move(arg1, GPRInfo::argumentGPR1);
     448        move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     449    }
     450
    430451    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2)
    431452    {
     
    456477
    457478    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2)
     479    {
     480        move(arg2, GPRInfo::argumentGPR2); // Move this first, so setting arg1 does not trample!
     481        move(arg1, GPRInfo::argumentGPR1);
     482        move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     483    }
     484   
     485    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2)
    458486    {
    459487        move(arg2, GPRInfo::argumentGPR2); // Move this first, so setting arg1 does not trample!
Note: See TracChangeset for help on using the changeset viewer.