Changeset 36544 in webkit for trunk/JavaScriptCore/VM/Machine.cpp


Ignore:
Timestamp:
Sep 17, 2008, 12:29:19 PM (17 years ago)
Author:
[email protected]
Message:

2008-09-17 Gavin Barraclough <[email protected]>

Reviewed by Geoff Garen.

Optimizations for op_call in CTI. Move check for (ctiCode == 0) into JIT code,
move copying of scopeChain for CodeBlocks that needFullScopeChain into head of
functions, instead of checking prior to making the call.

3% on v8-tests (4% on richards, 6% in delta-blue)

  • VM/CTI.cpp: (JSC::CTI::compileOpCall): (JSC::CTI::privateCompileSlowCases): (JSC::CTI::privateCompile):
  • VM/Machine.cpp: (JSC::Machine::execute): (JSC::Machine::cti_op_call_JSFunction): (JSC::Machine::cti_vm_compile): (JSC::Machine::cti_vm_updateScopeChain): (JSC::Machine::cti_op_construct_JSConstruct):
  • VM/Machine.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/Machine.cpp

    r36514 r36544  
    929929    }
    930930
    931     scopeChain = scopeChainForCall(exec, functionBodyNode, newCodeBlock, scopeChain, r);
    932 
    933931    ExecState newExec(exec, &m_registerFile, scopeChain, callFrame);
    934932
     
    943941    JSValue* result = CTI::execute(newCodeBlock->ctiCode, &newExec, &m_registerFile, r, scopeChain, newCodeBlock, exception);
    944942#else
     943    setScopeChain(scopeChain, scopeChainForCall(exec, functionBodyNode, newCodeBlock, scopeChain, r));
    945944    JSValue* result = privateExecute(Normal, &newExec, &m_registerFile, r, scopeChain, newCodeBlock, exception);
    946945#endif
     
    43564355    JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue);
    43574356   
    4358     codeBlock = newCodeBlock;
    4359     machine->setScopeChain(exec, scopeChain, scopeChainForCall(exec, functionBodyNode, codeBlock, callDataScopeChain, r));
     4357    exec->m_scopeChain = callDataScopeChain;
     4358
     4359    ARG_setScopeChain(callDataScopeChain);
     4360    ARG_setCodeBlock(newCodeBlock);
     4361    ARG_setR(r);
     4362    return newCodeBlock->ctiCode;
     4363}
     4364
     4365void* Machine::cti_vm_compile(CTI_ARGS)
     4366{
     4367    ExecState* exec = ARG_exec;
     4368    CodeBlock* codeBlock = ARG_codeBlock;
    43604369
    43614370    if (!codeBlock->ctiCode)
    4362         CTI::compile(machine, exec, codeBlock);
     4371        CTI::compile(exec->machine(), exec, codeBlock);
     4372
     4373    return codeBlock->ctiCode;
     4374}
     4375
     4376void Machine::cti_vm_updateScopeChain(CTI_ARGS)
     4377{
     4378    ExecState* exec = ARG_exec;
     4379    CodeBlock* codeBlock = ARG_codeBlock;
     4380    ScopeChainNode* scopeChain = ARG_scopeChain;
     4381
     4382    exec->machine()->setScopeChain(exec, scopeChain, scopeChainForCall(exec, static_cast<FunctionBodyNode*>(codeBlock->ownerNode), codeBlock, scopeChain, ARG_r));
    43634383
    43644384    ARG_setScopeChain(scopeChain);
    4365     ARG_setCodeBlock(codeBlock);
    4366     ARG_setR(r);
    4367     return codeBlock->ctiCode;
    43684385}
    43694386
     
    45334550    JSVALUE_VM_CHECK_EXCEPTION_ARG(exceptionValue);
    45344551
    4535     codeBlock = newCodeBlock;
    4536     machine->setScopeChain(exec, scopeChain, scopeChainForCall(exec, functionBodyNode, codeBlock, callDataScopeChain, r));
    4537 
    4538     if (!codeBlock->ctiCode)
    4539         CTI::compile(machine, exec, codeBlock);
    4540 
    4541     ARG_setScopeChain(scopeChain);
    4542     ARG_setCodeBlock(codeBlock);
     4552    exec->m_scopeChain = callDataScopeChain;
     4553
     4554    ARG_setScopeChain(callDataScopeChain);
     4555    ARG_setCodeBlock(newCodeBlock);
    45434556    ARG_setR(r);
    4544     return codeBlock->ctiCode;
     4557    return newCodeBlock->ctiCode;
    45454558}
    45464559
Note: See TracChangeset for help on using the changeset viewer.