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


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):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.