Changeset 36566 in webkit for trunk/JavaScriptCore/VM/CTI.cpp


Ignore:
Timestamp:
Sep 17, 2008, 3:40:23 PM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Geoff Garen.

Implement JIT generation of CallFrame initialization, for op_call.

1% sunspider 2.5% v8-tests.

  • VM/CTI.cpp: (JSC::CTI::compileOpCall):
  • VM/Machine.cpp: (JSC::Machine::cti_op_call_JSFunction): (JSC::Machine::cti_op_call_NotJSFunction):
File:
1 edited

Legend:

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

    r36544 r36566  
    417417void CTI::compileOpCall(Instruction* instruction, unsigned i, CompileOpCallType type)
    418418{
     419    int dst = instruction[i + 1].u.operand;
     420    int firstArg = instruction[i + 4].u.operand;
     421    int argCount = instruction[i + 5].u.operand;
     422
    419423    if (type == OpConstruct) {
    420424        emitPutArgConstant(reinterpret_cast<unsigned>(instruction + i), 16);
    421         emitPutArgConstant(instruction[i + 5].u.operand, 12);
    422         emitPutArgConstant(instruction[i + 4].u.operand, 8);
     425        emitPutArgConstant(argCount, 12);
     426        emitPutArgConstant(firstArg, 8);
    423427        emitGetPutArg(instruction[i + 3].u.operand, 4, X86::ecx);
    424428    } else {
    425429        emitPutArgConstant(reinterpret_cast<unsigned>(instruction + i), 16);
    426         emitPutArgConstant(instruction[i + 5].u.operand, 12);
    427         emitPutArgConstant(instruction[i + 4].u.operand, 8);
     430        emitPutArgConstant(argCount, 12);
     431        emitPutArgConstant(firstArg, 8);
    428432        // FIXME: should this be loaded dynamically off m_exec?
    429433        int thisVal = instruction[i + 3].u.operand;
     
    452456        emitPutArg(X86::ecx, 0);
    453457    }
     458
     459    // initializeCallFrame!
     460    m_jit.movl_i32m(reinterpret_cast<unsigned>(m_codeBlock), (firstArg - RegisterFile::CallFrameHeaderSize + RegisterFile::CallerCodeBlock) * sizeof(Register), X86::edi);
     461    m_jit.movl_i32m(reinterpret_cast<unsigned>(instruction + i), (firstArg - RegisterFile::CallFrameHeaderSize + RegisterFile::ReturnVPC) * sizeof(Register), X86::edi);
     462    emitGetCTIParam(CTI_ARGS_scopeChain, X86::edx);
     463    m_jit.movl_rm(X86::edx, (firstArg - RegisterFile::CallFrameHeaderSize + RegisterFile::CallerScopeChain) * sizeof(Register), X86::edi);
     464    m_jit.movl_rm(X86::edi, (firstArg - RegisterFile::CallFrameHeaderSize + RegisterFile::CallerRegisters) * sizeof(Register), X86::edi);
     465    m_jit.movl_i32m(dst, (firstArg - RegisterFile::CallFrameHeaderSize + RegisterFile::ReturnValueRegister) * sizeof(Register), X86::edi);
     466    m_jit.movl_i32m(firstArg, (firstArg - RegisterFile::CallFrameHeaderSize + RegisterFile::ArgumentStartRegister) * sizeof(Register), X86::edi);
     467    m_jit.movl_i32m(argCount, (firstArg - RegisterFile::CallFrameHeaderSize + RegisterFile::ArgumentCount) * sizeof(Register), X86::edi);
     468    m_jit.movl_rm(X86::ecx, (firstArg - RegisterFile::CallFrameHeaderSize + RegisterFile::Callee) * sizeof(Register), X86::edi);
     469    m_jit.movl_i32m(0, (firstArg - RegisterFile::CallFrameHeaderSize + RegisterFile::OptionalCalleeActivation) * sizeof(Register), X86::edi);
     470    // CTIReturnEIP (set in callee)
    454471
    455472    // Fast check for JS function.
     
    491508        m_jit.link(wasEval, end);
    492509
    493     emitPutResult(instruction[i + 1].u.operand);
     510    emitPutResult(dst);
    494511}
    495512
Note: See TracChangeset for help on using the changeset viewer.