Changeset 34032 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
May 22, 2008, 12:55:18 PM (17 years ago)
Author:
[email protected]
Message:

2008-05-22 Sam Weinig <[email protected]>

Reviewed by Oliver Hunt.

Rename register arguments for op_call, op_call_eval, op_end, and op_construct
to document what they are for.

  • VM/CodeGenerator.cpp: (KJS::CodeGenerator::emitCall): (KJS::CodeGenerator::emitCallEval): (KJS::CodeGenerator::emitEnd): (KJS::CodeGenerator::emitConstruct):
  • VM/CodeGenerator.h:
  • VM/Machine.cpp: (KJS::Machine::privateExecute):
Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r34030 r34032  
     12008-05-22  Sam Weinig  <[email protected]>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Rename register arguments for op_call, op_call_eval, op_end, and op_construct
     6        to document what they are for.
     7
     8        * VM/CodeGenerator.cpp:
     9        (KJS::CodeGenerator::emitCall):
     10        (KJS::CodeGenerator::emitCallEval):
     11        (KJS::CodeGenerator::emitEnd):
     12        (KJS::CodeGenerator::emitConstruct):
     13        * VM/CodeGenerator.h:
     14        * VM/Machine.cpp:
     15        (KJS::Machine::privateExecute):
     16
    1172008-05-22  Oliver Hunt  <[email protected]>
    218
  • trunk/JavaScriptCore/VM/CodeGenerator.cpp

    r33979 r34032  
    944944}
    945945
    946 RegisterID* CodeGenerator::emitCall(RegisterID* r0, RegisterID* r1, RegisterID* r2, ArgumentsNode* argumentsNode)
    947 {
    948     return emitCall(op_call, r0, r1, r2, argumentsNode);
    949 }
    950 
    951 RegisterID* CodeGenerator::emitCallEval(RegisterID* r0, RegisterID* r1, RegisterID* r2, ArgumentsNode* argumentsNode)
    952 {
    953     return emitCall(op_call_eval, r0, r1, r2, argumentsNode);
    954 }
    955 
    956 RegisterID* CodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* r0, RegisterID* r1, RegisterID* r2, ArgumentsNode* argumentsNode)
     946RegisterID* CodeGenerator::emitCall(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode* argumentsNode)
     947{
     948    return emitCall(op_call, dst, func, base, argumentsNode);
     949}
     950
     951RegisterID* CodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode* argumentsNode)
     952{
     953    return emitCall(op_call_eval, dst, func, base, argumentsNode);
     954}
     955
     956RegisterID* CodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode* argumentsNode)
    957957{
    958958    ASSERT(opcodeID == op_call || opcodeID == op_call_eval);
    959959
    960     RefPtr<RegisterID> ref1 = r1;
    961     RefPtr<RegisterID> ref2 = r2;
     960    RefPtr<RegisterID> refFunc = func;
     961    RefPtr<RegisterID> refBase = base;
    962962   
    963963    // Reserve space for call frame.
     
    975975
    976976    instructions().append(machine().getOpcode(opcodeID));
    977     instructions().append(r0->index());
    978     instructions().append(r1->index());
    979     instructions().append(r2 ? r2->index() : missingThisObjectMarker()); // We encode the "this" value in the instruction stream, to avoid an explicit instruction for copying or loading it.
     977    instructions().append(dst->index());
     978    instructions().append(func->index());
     979    instructions().append(base ? base->index() : missingThisObjectMarker()); // We encode the "this" value in the instruction stream, to avoid an explicit instruction for copying or loading it.
    980980    instructions().append(argv.size() ? argv[0]->index() : m_temporaries.size()); // argv
    981981    instructions().append(argv.size()); // argc
    982 
    983     return r0;
     982    return dst;
    984983}
    985984
     
    991990}
    992991
    993 RegisterID* CodeGenerator::emitEnd(RegisterID* r0)
     992RegisterID* CodeGenerator::emitEnd(RegisterID* dst)
    994993{
    995994    instructions().append(machine().getOpcode(op_end));
    996     instructions().append(r0->index());
    997     return r0;
    998 }
    999 
    1000 RegisterID* CodeGenerator::emitConstruct(RegisterID* r0, RegisterID* r1, ArgumentsNode* argumentsNode)
     995    instructions().append(dst->index());
     996    return dst;
     997}
     998
     999RegisterID* CodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode* argumentsNode)
    10011000{
    10021001    // Reserve space for call frame.
     
    10141013
    10151014    instructions().append(machine().getOpcode(op_construct));
    1016     instructions().append(r0->index());
    1017     instructions().append(r1->index());
     1015    instructions().append(dst->index());
     1016    instructions().append(func->index());
    10181017    instructions().append(argv.size() ? argv[0]->index() : m_temporaries.size()); // argv
    10191018    instructions().append(argv.size()); // argc
    1020     return r0;
     1019    return dst;
    10211020}
    10221021
  • trunk/JavaScriptCore/VM/CodeGenerator.h

    r33979 r34032  
    249249        RegisterID* emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value);
    250250
    251         RegisterID* emitCall(RegisterID*, RegisterID*, RegisterID*, ArgumentsNode*);
    252         RegisterID* emitCallEval(RegisterID*, RegisterID*, RegisterID*, ArgumentsNode*);
     251        RegisterID* emitCall(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode*);
     252        RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode*);
    253253        RegisterID* emitReturn(RegisterID*);
    254         RegisterID* emitEnd(RegisterID*);
    255 
    256         RegisterID* emitConstruct(RegisterID*, RegisterID*, ArgumentsNode*);
     254        RegisterID* emitEnd(RegisterID* dst);
     255
     256        RegisterID* emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode*);
    257257
    258258        PassRefPtr<LabelID> emitLabel(LabelID*);
  • trunk/JavaScriptCore/VM/Machine.cpp

    r34009 r34032  
    17991799    }
    18001800    BEGIN_OPCODE(op_call_eval) {
    1801         int r0 = (++vPC)->u.operand;
    1802         int r1 = (++vPC)->u.operand;
    1803         int r2 = (++vPC)->u.operand;
     1801        int dst = (++vPC)->u.operand;
     1802        int func = (++vPC)->u.operand;
     1803        int base = (++vPC)->u.operand;
    18041804        int argv = (++vPC)->u.operand;
    18051805        int argc = (++vPC)->u.operand;
    18061806
    1807         JSValue* v = r[r1].u.jsValue;
    1808         JSValue* base = r[r2].u.jsValue;
    1809        
    1810         if (base == scopeChain->globalObject() && v == scopeChain->globalObject()->evalFunction()) {
     1807        JSValue* funcVal = r[func].u.jsValue;
     1808        JSValue* baseVal = r[base].u.jsValue;
     1809       
     1810        if (baseVal == scopeChain->globalObject() && funcVal == scopeChain->globalObject()->evalFunction()) {
    18111811            int registerOffset = r - (*registerBase);
    18121812
     
    18211821                goto vm_throw;
    18221822
    1823             r[r0].u.jsValue = result;
     1823            r[dst].u.jsValue = result;
    18241824           
    18251825            ++vPC;
     
    18311831        // value.
    18321832        vPC -= 5;
    1833         r[r2].u.jsValue = base->toObject(exec)->toThisObject(exec);
     1833        r[base].u.jsValue = baseVal->toObject(exec)->toThisObject(exec);
    18341834
    18351835#if HAVE(COMPUTED_GOTO)
     
    18421842    }
    18431843    BEGIN_OPCODE(op_call) {
    1844         int r0 = (++vPC)->u.operand;
    1845         int r1 = (++vPC)->u.operand;
    1846         int r2 = (++vPC)->u.operand;
     1844        int dst = (++vPC)->u.operand;
     1845        int func = (++vPC)->u.operand;
     1846        int base = (++vPC)->u.operand;
    18471847        int argv = (++vPC)->u.operand;
    18481848        int argc = (++vPC)->u.operand;
    18491849       
    1850         JSValue* v = r[r1].u.jsValue;
     1850        JSValue* v = r[func].u.jsValue;
    18511851       
    18521852        CallData callData;
     
    18581858            int callFrameOffset = registerOffset + argv - CallFrameHeaderSize;
    18591859
    1860             r[argv].u.jsValue = r2 == missingThisObjectMarker() ? exec->globalThisValue() : r[r2].u.jsValue; // "this" value
    1861             initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, registerOffset, r0, argv, argc, 0, v);
     1860            r[argv].u.jsValue = base == missingThisObjectMarker() ? exec->globalThisValue() : r[base].u.jsValue; // "this" value
     1861            initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, registerOffset, dst, argv, argc, 0, v);
    18621862
    18631863            ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
     
    18811881            int registerOffset = r - (*registerBase);
    18821882           
    1883             r[argv].u.jsValue = r2 == missingThisObjectMarker() ? exec->globalThisValue() : (r[r2].u.jsValue)->toObject(exec); // "this" value
     1883            r[argv].u.jsValue = base == missingThisObjectMarker() ? exec->globalThisValue() : (r[base].u.jsValue)->toObject(exec); // "this" value
    18841884            JSObject* thisObj = static_cast<JSObject*>(r[argv].u.jsValue);
    18851885
     
    18911891
    18921892            r = (*registerBase) + registerOffset;
    1893             r[r0].u.jsValue = returnValue;
     1893            r[dst].u.jsValue = returnValue;
    18941894
    18951895            VM_CHECK_EXCEPTION();
     
    19421942    }
    19431943    BEGIN_OPCODE(op_construct) {
    1944         int r0 = (++vPC)->u.operand;
    1945         int r1 = (++vPC)->u.operand;
     1944        int dst = (++vPC)->u.operand;
     1945        int func = (++vPC)->u.operand;
    19461946        int argv = (++vPC)->u.operand;
    19471947        int argc = (++vPC)->u.operand;
    19481948
    1949         JSValue* v = r[r1].u.jsValue;
     1949        JSValue* funcVal = r[func].u.jsValue;
    19501950
    19511951        ConstructData constructData;
    1952         ConstructType constructType = v->getConstructData(constructData);
     1952        ConstructType constructType = funcVal->getConstructData(constructData);
    19531953
    19541954        // Removing this line of code causes a measurable regression on squirrelfish.
    1955         JSObject* constructor = static_cast<JSObject*>(v);
     1955        JSObject* constructor = static_cast<JSObject*>(funcVal);
    19561956
    19571957        if (constructType == ConstructTypeJS) {
     
    19691969            r[argv].u.jsValue = newObject; // "this" value
    19701970
    1971             initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, registerOffset, r0, argv, argc, 1, constructor);
    1972            
     1971            initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, registerOffset, dst, argv, argc, 1, constructor);
     1972
    19731973            ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
    19741974            FunctionBodyNode* functionBodyNode = constructData.js.functionBody;
     
    19951995            JSValue* returnValue = constructor->construct(exec, args);
    19961996            registerFile->setSafeForReentry(false);
    1997        
     1997
    19981998            r = (*registerBase) + registerOffset;
    19991999            VM_CHECK_EXCEPTION();
    2000             r[r0].u.jsValue = returnValue;
    2001            
     2000            r[dst].u.jsValue = returnValue;
     2001
    20022002            ++vPC;
    20032003            NEXT_OPCODE;
     
    20062006        ASSERT(constructType == ConstructTypeNone);
    20072007
    2008         exceptionValue = createNotAConstructorError(exec, v, 0);
     2008        exceptionValue = createNotAConstructorError(exec, funcVal, 0);
    20092009        goto vm_throw;
    20102010    }
Note: See TracChangeset for help on using the changeset viewer.