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


Ignore:
Timestamp:
Sep 16, 2008, 10:40:01 AM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Geoff Garen.

CTI code generation for op_ret. The majority of the work
(updating variables on the stack & on exec) can be performed
directly in generated code.

We still need to check, & to call out to C-code to handle
activation records, profiling, and full scope chains.

+1.5% Sunspider, +5/6% v8 tests.

  • VM/CTI.cpp: (JSC::CTI::emitPutCTIParam): (JSC::CTI::compileOpCall): (JSC::CTI::privateCompileMainPass):
  • VM/CTI.h:
  • VM/Machine.cpp: (JSC::Machine::cti_op_ret_activation): (JSC::Machine::cti_op_ret_profiler): (JSC::Machine::cti_op_ret_scopeChain):
  • VM/Machine.h:
File:
1 edited

Legend:

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

    r36509 r36514  
    44184418}
    44194419
    4420 JSValue* Machine::cti_op_ret(CTI_ARGS)
    4421 {
    4422     ExecState* exec = ARG_exec;
    4423     Register* r = ARG_r;
    4424     CodeBlock* codeBlock = ARG_codeBlock;
    4425     ScopeChainNode* scopeChain = ARG_scopeChain;
    4426 
    4427     Machine* machine = exec->machine();
    4428 
    4429     Register* callFrame = r - codeBlock->numLocals - RegisterFile::CallFrameHeaderSize;
    4430     if (JSActivation* activation = static_cast<JSActivation*>(callFrame[RegisterFile::OptionalCalleeActivation].jsValue(exec))) {
    4431         ASSERT(!codeBlock->needsFullScopeChain || scopeChain->object == activation);
    4432         ASSERT(activation->isActivationObject());
    4433         activation->copyRegisters();
    4434     }
    4435 
    4436     if (*ARG_profilerReference)
    4437         (*ARG_profilerReference)->didExecute(exec, static_cast<JSObject*>(callFrame[RegisterFile::Callee].jsValue(exec)));
    4438 
    4439     if (codeBlock->needsFullScopeChain)
    4440         scopeChain->deref();
    4441 
    4442     codeBlock = callFrame[RegisterFile::CallerCodeBlock].codeBlock();
    4443     if (codeBlock) {
    4444         machine->setScopeChain(exec, scopeChain, callFrame[RegisterFile::CallerScopeChain].scopeChain());
    4445         r = callFrame[RegisterFile::CallerRegisters].r();
    4446         exec->m_callFrame = r - codeBlock->numLocals - RegisterFile::CallFrameHeaderSize;
    4447     }
    4448 
    4449     ARG_setScopeChain(scopeChain);
    4450     ARG_setCodeBlock(codeBlock);
    4451     ARG_setR(r);
    4452 
    4453     return ARG_src1;
     4420void Machine::cti_op_ret_activation(CTI_ARGS)
     4421{
     4422    ExecState* exec = ARG_exec;
     4423    Register* callFrame = ARG_r - ARG_codeBlock->numLocals - RegisterFile::CallFrameHeaderSize;
     4424
     4425    JSActivation* activation = static_cast<JSActivation*>(callFrame[RegisterFile::OptionalCalleeActivation].jsValue(exec));
     4426    ASSERT(activation);
     4427
     4428    ASSERT(!ARG_codeBlock->needsFullScopeChain || ARG_scopeChain->object == activation);
     4429    ASSERT(activation->isActivationObject());
     4430    activation->copyRegisters();
     4431}
     4432
     4433void Machine::cti_op_ret_profiler(CTI_ARGS)
     4434{
     4435    ExecState* exec = ARG_exec;
     4436
     4437    Register* callFrame = ARG_r - ARG_codeBlock->numLocals - RegisterFile::CallFrameHeaderSize;
     4438    ASSERT(*ARG_profilerReference);
     4439    (*ARG_profilerReference)->didExecute(exec, static_cast<JSObject*>(callFrame[RegisterFile::Callee].jsValue(exec)));
     4440}
     4441
     4442void Machine::cti_op_ret_scopeChain(CTI_ARGS)
     4443{
     4444    ASSERT(ARG_codeBlock->needsFullScopeChain);
     4445    ARG_scopeChain->deref();
    44544446}
    44554447
Note: See TracChangeset for help on using the changeset viewer.