Changeset 36882 in webkit


Ignore:
Timestamp:
Sep 24, 2008 7:46:09 PM (16 years ago)
Author:
ggaren@apple.com
Message:

2008-09-24 Geoffrey Garen <ggaren@apple.com>

Reviewed by Maciej Stachowiak.


Move most of the return code back into the callee, now that the callee
doesn't have to calculate anything dynamically.


11.5% speedup on empty function call benchmark.


SunSpider says 0.3% faster. SunSpider --v8 says no change.

  • VM/CTI.cpp: (JSC::CTI::compileOpCall): (JSC::CTI::privateCompileMainPass): (JSC::CTI::privateCompileSlowCases):
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r36877 r36882  
     12008-09-24  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4       
     5        Move most of the return code back into the callee, now that the callee
     6        doesn't have to calculate anything dynamically.
     7       
     8        11.5% speedup on empty function call benchmark.
     9       
     10        SunSpider says 0.3% faster. SunSpider --v8 says no change.
     11
     12        * VM/CTI.cpp:
     13        (JSC::CTI::compileOpCall):
     14        (JSC::CTI::privateCompileMainPass):
     15        (JSC::CTI::privateCompileSlowCases):
     16
    1172008-09-24  Sam Weinig  <sam@webkit.org>
    218
  • trunk/JavaScriptCore/VM/CTI.cpp

    r36876 r36882  
    521521    emitCall(i, X86::eax);
    522522   
    523     // In the interpreter the following actions are performed by op_ret:
    524 
    525     // Restore ExecState::m_scopeChain and CTI_ARGS_scopeChain. NOTE: After
    526     // op_ret, %edx holds the caller's scope chain.
    527     emitGetCTIParam(CTI_ARGS_exec, X86::ecx);
    528     emitPutCTIParam(X86::edx, CTI_ARGS_scopeChain);
    529     m_jit.movl_rm(X86::edx, OBJECT_OFFSET(ExecState, m_scopeChain), X86::ecx);
    530     // Restore ExecState::m_callFrame.
    531     m_jit.movl_rm(X86::edi, OBJECT_OFFSET(ExecState, m_callFrame), X86::ecx);
    532     // Restore CTI_ARGS_codeBlock.
     523    // Restore CTI_ARGS_codeBlock. In the interpreter, op_ret does this.
    533524    emitPutCTIParam(m_codeBlock, CTI_ARGS_codeBlock);
    534525
     
    538529        m_jit.link(wasEval, end);
    539530
     531    // Put the return value in dst. In the interpreter, op_ret does this.
    540532    emitPutResult(dst);
    541533}
     
    988980                emitCall(i, Machine::cti_op_ret_scopeChain);
    989981
    990             // Return the result in %eax, and the caller scope chain in %edx (this is read from the callee call frame,
    991             // but is only assigned to ExecState::m_scopeChain if returning to a JSFunction).
     982            // Return the result in %eax.
    992983            emitGetArg(instruction[i + 1].u.operand, X86::eax);
     984
     985            // Restore the scope chain.
    993986            m_jit.movl_mr(RegisterFile::CallerScopeChain * static_cast<int>(sizeof(Register)), X86::edi, X86::edx);
     987            emitGetCTIParam(CTI_ARGS_exec, X86::ecx);
     988            emitPutCTIParam(X86::edx, CTI_ARGS_scopeChain);
     989            m_jit.movl_rm(X86::edx, OBJECT_OFFSET(ExecState, m_scopeChain), X86::ecx);
     990
     991            // Restore ExecState::m_callFrame.
     992            m_jit.movl_rm(X86::edi, OBJECT_OFFSET(ExecState, m_callFrame), X86::ecx);
     993
     994            // Grab the return address.
     995            m_jit.movl_mr(RegisterFile::ReturnPC * static_cast<int>(sizeof(Register)), X86::edi, X86::ecx);
     996
    994997            // Restore the machine return addess from the callframe, roll the callframe back to the caller callframe,
    995998            // and preserve a copy of r on the stack at CTI_ARGS_r.
    996             m_jit.movl_mr(RegisterFile::ReturnPC * static_cast<int>(sizeof(Register)), X86::edi, X86::ecx);
    997999            m_jit.movl_mr(RegisterFile::CallerRegisters * static_cast<int>(sizeof(Register)), X86::edi, X86::edi);
    9981000            emitPutCTIParam(X86::edi, CTI_ARGS_r);
     
    22422244            // Instead of checking for 0 we could initialize the CodeBlock::ctiCode to point to a trampoline that would trigger the translation.
    22432245
    2244             // In the interpreter the following actions are performed by op_ret:
    2245 
    2246             // Restore ExecState::m_scopeChain and CTI_ARGS_scopeChain. NOTE: After
    2247             // op_ret, %edx holds the caller's scope chain.
    2248             emitGetCTIParam(CTI_ARGS_exec, X86::ecx);
    2249             emitPutCTIParam(X86::edx, CTI_ARGS_scopeChain);
    2250             m_jit.movl_rm(X86::edx, OBJECT_OFFSET(ExecState, m_scopeChain), X86::ecx);
    2251             // Restore ExecState::m_callFrame.
    2252             m_jit.movl_rm(X86::edi, OBJECT_OFFSET(ExecState, m_callFrame), X86::ecx);
    2253             // Restore CTI_ARGS_codeBlock.
     2246            // Restore CTI_ARGS_codeBlock. In the interpreter, op_ret does this.
    22542247            emitPutCTIParam(m_codeBlock, CTI_ARGS_codeBlock);
    22552248
     2249            // Put the return value in dst. In the interpreter, op_ret does this.
    22562250            emitPutResult(instruction[i + 1].u.operand);
    22572251            i += 7;
Note: See TracChangeset for help on using the changeset viewer.