Changeset 95927 in webkit


Ignore:
Timestamp:
Sep 25, 2011 5:01:09 PM (13 years ago)
Author:
fpizlo@apple.com
Message:

DFG JIT Construct opcode takes a this argument even though it's
not passed
https://bugs.webkit.org/show_bug.cgi?id=68782

Reviewed by Oliver Hunt.

This is performance-neutral, mostly. It's a slight speed-up on
v8-splay.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::addCall):

  • dfg/DFGJITCodeGenerator.cpp:

(JSC::DFG::JITCodeGenerator::emitCall):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r95925 r95927  
     12011-09-25  Filip Pizlo  <fpizlo@apple.com>
     2
     3        DFG JIT Construct opcode takes a this argument even though it's
     4        not passed
     5        https://bugs.webkit.org/show_bug.cgi?id=68782
     6
     7        Reviewed by Oliver Hunt.
     8       
     9        This is performance-neutral, mostly. It's a slight speed-up on
     10        v8-splay.
     11       
     12        * dfg/DFGByteCodeParser.cpp:
     13        (JSC::DFG::ByteCodeParser::addCall):
     14        * dfg/DFGJITCodeGenerator.cpp:
     15        (JSC::DFG::JITCodeGenerator::emitCall):
     16
    1172011-09-25  Filip Pizlo  <fpizlo@apple.com>
    218
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r95916 r95927  
    443443        int registerOffset = currentInstruction[3].u.operand;
    444444        int firstArg = registerOffset - argCount - RegisterFile::CallFrameHeaderSize;
    445         for (int argIdx = firstArg; argIdx < firstArg + argCount; argIdx++)
     445        for (int argIdx = firstArg + (op == Construct ? 1 : 0); argIdx < firstArg + argCount; argIdx++)
    446446            addVarArgChild(get(argIdx));
    447447        NodeIndex call = addToGraph(Node::VarArg, op, OpInfo(0), OpInfo(prediction));
  • trunk/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp

    r95902 r95927  
    18841884    int numArgs = node.numChildren() - 1;
    18851885   
     1886    // For constructors, the this argument is not passed but we have to make space
     1887    // for it.
     1888    int numPassedArgs = numArgs + (isCall ? 0 : 1);
     1889   
    18861890    // amount of stuff (in units of sizeof(Register)) that we need to place at the
    18871891    // top of the JS stack.
     
    18891893
    18901894    // first there are the arguments
    1891     callDataSize += numArgs;
     1895    callDataSize += numPassedArgs;
    18921896   
    18931897    // and then there is the call frame header
    18941898    callDataSize += RegisterFile::CallFrameHeaderSize;
    18951899   
    1896     m_jit.storePtr(MacroAssembler::TrustedImmPtr(JSValue::encode(jsNumber(numArgs))), addressOfCallData(RegisterFile::ArgumentCount));
     1900    m_jit.storePtr(MacroAssembler::TrustedImmPtr(JSValue::encode(jsNumber(numPassedArgs))), addressOfCallData(RegisterFile::ArgumentCount));
    18971901    m_jit.storePtr(GPRInfo::callFrameRegister, addressOfCallData(RegisterFile::CallerFrame));
    18981902   
    1899     if (node.op == Construct)
    1900         use(m_jit.graph().m_varArgChildren[node.firstChild() + 1]);
    1901    
    1902     for (int argIdx = (node.op == Call ? 0 : 1); argIdx < numArgs; argIdx++) {
     1903    for (int argIdx = 0; argIdx < numArgs; argIdx++) {
    19031904        NodeIndex argNodeIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 1 + argIdx];
    19041905        JSValueOperand arg(this, argNodeIndex);
     
    19061907        use(argNodeIndex);
    19071908       
    1908         m_jit.storePtr(argGPR, addressOfCallData(-callDataSize + argIdx));
     1909        m_jit.storePtr(argGPR, addressOfCallData(-callDataSize + argIdx + (isCall ? 0 : 1)));
    19091910    }
    19101911   
     
    19341935    m_jit.addPtr(Imm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
    19351936    JITCompiler::Call slowCall = m_jit.appendCallWithFastExceptionCheck(slowCallFunction, m_jit.graph()[m_compileIndex].codeOrigin);
    1936     m_jit.move(Imm32(numArgs), GPRInfo::regT1);
     1937    m_jit.move(Imm32(numPassedArgs), GPRInfo::regT1);
    19371938    m_jit.addPtr(Imm32(m_jit.codeBlock()->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister);
    19381939    m_jit.notifyCall(m_jit.call(GPRInfo::returnValueGPR), m_jit.graph()[m_compileIndex].codeOrigin);
Note: See TracChangeset for help on using the changeset viewer.