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


Ignore:
Timestamp:
Nov 12, 2008, 1:34:22 AM (17 years ago)
Author:
[email protected]
Message:

2008-11-12 Cameron Zwarich <[email protected]>

Rubber-stamped by Mark Rowe.

Roll out r38322 due to test failures on the bots.

JavaScriptCore:

  • VM/CTI.cpp: (JSC::CTI::compileOpCallSetupArgs): (JSC::CTI::compileOpCall): (JSC::CTI::privateCompileMainPass): (JSC::CTI::privateCompileSlowCases):
  • VM/CTI.h:
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • VM/Machine.cpp: (JSC::Machine::callEval): (JSC::Machine::dumpCallFrame): (JSC::Machine::dumpRegisters): (JSC::Machine::execute): (JSC::Machine::privateExecute): (JSC::Machine::throwStackOverflowPreviousFrame): (JSC::Machine::cti_register_file_check): (JSC::Machine::cti_op_call_arityCheck): (JSC::Machine::cti_op_call_NotJSFunction): (JSC::Machine::cti_op_construct_JSConstruct): (JSC::Machine::cti_op_construct_NotJSConstruct): (JSC::Machine::cti_op_call_eval): (JSC::Machine::cti_vm_throw):
  • VM/Machine.h:
  • bytecompiler/CodeGenerator.cpp: (JSC::CodeGenerator::emitCall): (JSC::CodeGenerator::emitCallEval): (JSC::CodeGenerator::emitConstruct):
  • bytecompiler/CodeGenerator.h:
  • parser/Nodes.cpp: (JSC::EvalFunctionCallNode::emitCode): (JSC::FunctionCallValueNode::emitCode): (JSC::FunctionCallResolveNode::emitCode): (JSC::FunctionCallBracketNode::emitCode): (JSC::FunctionCallDotNode::emitCode):
  • parser/Nodes.h: (JSC::ScopeNode::neededConstants):

LayoutTests:

  • fast/js/global-recursion-on-full-stack-expected.txt:
File:
1 edited

Legend:

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

    r38322 r38330  
    588588}
    589589
    590 void CTI::compileOpCallSetupArgs(Instruction* instruction)
    591 {
    592     int argCount = instruction[3].u.operand;
    593     int registerOffset = instruction[4].u.operand;
    594 
    595     // ecx holds func
     590void CTI::compileOpCallSetupArgs(Instruction* instruction, bool isConstruct, bool isEval)
     591{
     592    int firstArg = instruction[4].u.operand;
     593    int argCount = instruction[5].u.operand;
     594    int registerOffset = instruction[6].u.operand;
     595
    596596    emitPutArg(X86::ecx, 0);
    597597    emitPutArgConstant(registerOffset, 4);
    598598    emitPutArgConstant(argCount, 8);
    599599    emitPutArgConstant(reinterpret_cast<unsigned>(instruction), 12);
    600 }
    601 
    602 void CTI::compileOpCallEvalSetupArgs(Instruction* instruction)
    603 {
    604     int argCount = instruction[3].u.operand;
    605     int registerOffset = instruction[4].u.operand;
    606 
    607     // ecx holds func
    608     emitPutArg(X86::ecx, 0);
    609     emitPutArgConstant(registerOffset, 4);
    610     emitPutArgConstant(argCount, 8);
    611     emitPutArgConstant(reinterpret_cast<unsigned>(instruction), 12);
    612 }
    613 
    614 void CTI::compileOpConstructSetupArgs(Instruction* instruction)
    615 {
    616     int argCount = instruction[3].u.operand;
    617     int registerOffset = instruction[4].u.operand;
    618     int proto = instruction[5].u.operand;
    619     int thisRegister = instruction[6].u.operand;
    620 
    621     // ecx holds func
    622     emitPutArg(X86::ecx, 0);
    623     emitPutArgConstant(registerOffset, 4);
    624     emitPutArgConstant(argCount, 8);
    625     emitGetPutArg(proto, 12, X86::eax);
    626     emitPutArgConstant(thisRegister, 16);
    627     emitPutArgConstant(reinterpret_cast<unsigned>(instruction), 20);
     600    if (isConstruct) {
     601        emitGetPutArg(instruction[3].u.operand, 16, X86::eax);
     602        emitPutArgConstant(firstArg, 20);
     603    } else if (isEval)
     604        emitGetPutArg(instruction[3].u.operand, 16, X86::eax);
    628605}
    629606
     
    632609    int dst = instruction[1].u.operand;
    633610    int callee = instruction[2].u.operand;
    634     int argCount = instruction[3].u.operand;
    635     int registerOffset = instruction[4].u.operand;
     611    int firstArg = instruction[4].u.operand;
     612    int argCount = instruction[5].u.operand;
     613    int registerOffset = instruction[6].u.operand;
     614
     615    // Setup this value as the first argument (does not apply to constructors)
     616    if (opcodeID != op_construct) {
     617        int thisVal = instruction[3].u.operand;
     618        if (thisVal == missingThisObjectMarker())
     619            m_jit.movl_i32m(asInteger(jsNull()), firstArg * sizeof(Register), X86::edi);
     620        else {
     621            emitGetArg(thisVal, X86::eax);
     622            emitPutResult(firstArg);
     623        }
     624    }
    636625
    637626    // Handle eval
     
    639628    if (opcodeID == op_call_eval) {
    640629        emitGetArg(callee, X86::ecx);
    641         compileOpCallEvalSetupArgs(instruction);
     630        compileOpCallSetupArgs(instruction, false, true);
    642631
    643632        emitCTICall(instruction, i, Machine::cti_op_call_eval);
     
    659648    // In the case of OpConstruct, call out to a cti_ function to create the new object.
    660649    if (opcodeID == op_construct) {
    661         int proto = instruction[5].u.operand;
    662         int thisRegister = instruction[6].u.operand;
    663 
    664650        emitPutArg(X86::ecx, 0);
    665         emitGetPutArg(proto, 12, X86::eax);
     651        emitGetPutArg(instruction[3].u.operand, 16, X86::eax);
    666652        emitCTICall(instruction, i, Machine::cti_op_construct_JSConstruct);
    667         emitPutResult(thisRegister);
     653        emitPutResult(firstArg);
    668654        emitGetArg(callee, X86::ecx);
    669655    }
     
    13001286            break;
    13011287        }
    1302         case op_call:
    1303         case op_call_eval:
    1304         case op_construct: {
     1288        case op_call: {
    13051289            compileOpCall(opcodeID, instruction + i, i, callLinkInfoIndex++);
    1306             i += (opcodeID == op_construct ? 7 : 5);
     1290            i += 7;
    13071291            break;
    13081292        }
     
    13961380            emitPutResult(instruction[i + 1].u.operand);
    13971381            i += 3;
     1382            break;
     1383        }
     1384        case op_construct: {
     1385            compileOpCall(opcodeID, instruction + i, i, callLinkInfoIndex++);
     1386            i += 7;
    13981387            break;
    13991388        }
     
    19231912            emitPutResult(instruction[i + 1].u.operand);
    19241913            i += 5;
     1914            break;
     1915        }
     1916        case op_call_eval: {
     1917            compileOpCall(opcodeID, instruction + i, i, callLinkInfoIndex++);
     1918            i += 7;
    19251919            break;
    19261920        }
     
    27742768            int dst = instruction[i + 1].u.operand;
    27752769            int callee = instruction[i + 2].u.operand;
    2776             int argCount = instruction[i + 3].u.operand;
    2777             int registerOffset = instruction[i + 4].u.operand;
     2770            int firstArg = instruction[i + 4].u.operand;
     2771            int argCount = instruction[i + 5].u.operand;
     2772            int registerOffset = instruction[i + 6].u.operand;
    27782773
    27792774            m_jit.link(iter->from, m_jit.label());
    27802775
    27812776            // The arguments have been set up on the hot path for op_call_eval
    2782             if (opcodeID == op_call)
    2783                 compileOpCallSetupArgs(instruction + i);
    2784             else if (opcodeID == op_construct)
    2785                 compileOpConstructSetupArgs(instruction + i);
     2777            if (opcodeID != op_call_eval)
     2778                compileOpCallSetupArgs(instruction + i, (opcodeID == op_construct), false);
    27862779
    27872780            // Fast check for JS function.
     
    27912784            X86Assembler::JmpSrc callLinkFailNotJSFunction = m_jit.emitUnlinkedJne();
    27922785
    2793             // First, in the case of a construct, allocate the new object.
     2786            // First, in the cale of a construct, allocate the new object.
    27942787            if (opcodeID == op_construct) {
    27952788                emitCTICall(instruction, i, Machine::cti_op_construct_JSConstruct);
    2796                 emitPutResult(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
     2789                emitPutResult(firstArg);
    27972790                emitGetArg(callee, X86::ecx);
    27982791            }
     
    28352828
    28362829            // The arguments have been set up on the hot path for op_call_eval
    2837             if (opcodeID == op_call)
    2838                 compileOpCallSetupArgs(instruction + i);
    2839             else if (opcodeID == op_construct)
    2840                 compileOpConstructSetupArgs(instruction + i);
     2830            if (opcodeID != op_call_eval)
     2831                compileOpCallSetupArgs(instruction + i, (opcodeID == op_construct), false);
    28412832
    28422833            // Check for JSFunctions.
     
    28572848            m_jit.link(isJSFunction, m_jit.label());
    28582849
    2859             // First, in the case of a construct, allocate the new object.
     2850            // First, in the cale of a construct, allocate the new object.
    28602851            if (opcodeID == op_construct) {
    28612852                emitCTICall(instruction, i, Machine::cti_op_construct_JSConstruct);
    2862                 emitPutResult(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
     2853                emitPutResult(firstArg);
    28632854                emitGetArg(callee, X86::ecx);
    28642855            }
     
    29052896            ++callLinkInfoIndex;
    29062897
    2907             i += (opcodeID == op_construct ? 7 : 5);
     2898            i += 7;
    29082899            break;
    29092900        }
Note: See TracChangeset for help on using the changeset viewer.