2008-05-22 Sam Weinig <sam@webkit.org>
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 May 2008 19:55:18 +0000 (19:55 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 May 2008 19:55:18 +0000 (19:55 +0000)
        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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34032 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/VM/CodeGenerator.cpp
JavaScriptCore/VM/CodeGenerator.h
JavaScriptCore/VM/Machine.cpp

index 45916da..0f21ec5 100644 (file)
@@ -1,3 +1,19 @@
+2008-05-22  Sam Weinig  <sam@webkit.org>
+
+        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):
+
 2008-05-22  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Darin.
index a9ca7bc..8bf299c 100644 (file)
@@ -943,22 +943,22 @@ RegisterID* CodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNod
     return r0;
 }
 
-RegisterID* CodeGenerator::emitCall(RegisterID* r0, RegisterID* r1, RegisterID* r2, ArgumentsNode* argumentsNode)
+RegisterID* CodeGenerator::emitCall(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode* argumentsNode)
 {
-    return emitCall(op_call, r0, r1, r2, argumentsNode);
+    return emitCall(op_call, dst, func, base, argumentsNode);
 }
 
-RegisterID* CodeGenerator::emitCallEval(RegisterID* r0, RegisterID* r1, RegisterID* r2, ArgumentsNode* argumentsNode)
+RegisterID* CodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode* argumentsNode)
 {
-    return emitCall(op_call_eval, r0, r1, r2, argumentsNode);
+    return emitCall(op_call_eval, dst, func, base, argumentsNode);
 }
 
-RegisterID* CodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* r0, RegisterID* r1, RegisterID* r2, ArgumentsNode* argumentsNode)
+RegisterID* CodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode* argumentsNode)
 {
     ASSERT(opcodeID == op_call || opcodeID == op_call_eval);
 
-    RefPtr<RegisterID> ref1 = r1;
-    RefPtr<RegisterID> ref2 = r2;
+    RefPtr<RegisterID> refFunc = func;
+    RefPtr<RegisterID> refBase = base;
     
     // Reserve space for call frame.
     Vector<RefPtr<RegisterID>, Machine::CallFrameHeaderSize> callFrame;
@@ -974,13 +974,12 @@ RegisterID* CodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* r0, RegisterI
     }
 
     instructions().append(machine().getOpcode(opcodeID));
-    instructions().append(r0->index());
-    instructions().append(r1->index());
-    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.
+    instructions().append(dst->index());
+    instructions().append(func->index());
+    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.
     instructions().append(argv.size() ? argv[0]->index() : m_temporaries.size()); // argv
     instructions().append(argv.size()); // argc
-
-    return r0;
+    return dst;
 }
 
 RegisterID* CodeGenerator::emitReturn(RegisterID* r0)
@@ -990,14 +989,14 @@ RegisterID* CodeGenerator::emitReturn(RegisterID* r0)
     return r0;
 }
 
-RegisterID* CodeGenerator::emitEnd(RegisterID* r0)
+RegisterID* CodeGenerator::emitEnd(RegisterID* dst)
 {
     instructions().append(machine().getOpcode(op_end));
-    instructions().append(r0->index());
-    return r0;
+    instructions().append(dst->index());
+    return dst;
 }
 
-RegisterID* CodeGenerator::emitConstruct(RegisterID* r0, RegisterID* r1, ArgumentsNode* argumentsNode)
+RegisterID* CodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode* argumentsNode)
 {
     // Reserve space for call frame.
     Vector<RefPtr<RegisterID>, Machine::CallFrameHeaderSize> callFrame;
@@ -1013,11 +1012,11 @@ RegisterID* CodeGenerator::emitConstruct(RegisterID* r0, RegisterID* r1, Argumen
     }
 
     instructions().append(machine().getOpcode(op_construct));
-    instructions().append(r0->index());
-    instructions().append(r1->index());
+    instructions().append(dst->index());
+    instructions().append(func->index());
     instructions().append(argv.size() ? argv[0]->index() : m_temporaries.size()); // argv
     instructions().append(argv.size()); // argc
-    return r0;
+    return dst;
 }
 
 RegisterID* CodeGenerator::emitPushScope(RegisterID* scope)
index 805355e..3fcad7b 100644 (file)
@@ -248,12 +248,12 @@ namespace KJS {
         RegisterID* emitPutGetter(RegisterID* base, const Identifier& property, RegisterID* value);
         RegisterID* emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value);
 
-        RegisterID* emitCall(RegisterID*, RegisterID*, RegisterID*, ArgumentsNode*);
-        RegisterID* emitCallEval(RegisterID*, RegisterID*, RegisterID*, ArgumentsNode*);
+        RegisterID* emitCall(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode*);
+        RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode*);
         RegisterID* emitReturn(RegisterID*);
-        RegisterID* emitEnd(RegisterID*);
+        RegisterID* emitEnd(RegisterID* dst);
 
-        RegisterID* emitConstruct(RegisterID*, RegisterID*, ArgumentsNode*);
+        RegisterID* emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode*);
 
         PassRefPtr<LabelID> emitLabel(LabelID*);
         PassRefPtr<LabelID> emitJump(LabelID* target);
index c6f4ed2..7ef1f73 100644 (file)
@@ -1798,16 +1798,16 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
         NEXT_OPCODE;
     }
     BEGIN_OPCODE(op_call_eval) {
-        int r0 = (++vPC)->u.operand;
-        int r1 = (++vPC)->u.operand;
-        int r2 = (++vPC)->u.operand;
+        int dst = (++vPC)->u.operand;
+        int func = (++vPC)->u.operand;
+        int base = (++vPC)->u.operand;
         int argv = (++vPC)->u.operand;
         int argc = (++vPC)->u.operand;
 
-        JSValue* v = r[r1].u.jsValue;
-        JSValue* base = r[r2].u.jsValue;
+        JSValue* funcVal = r[func].u.jsValue;
+        JSValue* baseVal = r[base].u.jsValue;
         
-        if (base == scopeChain->globalObject() && v == scopeChain->globalObject()->evalFunction()) {
+        if (baseVal == scopeChain->globalObject() && funcVal == scopeChain->globalObject()->evalFunction()) {
             int registerOffset = r - (*registerBase);
 
             JSObject* thisObject = r[codeBlock->thisRegister].u.jsObject;
@@ -1820,7 +1820,7 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
             if (exceptionValue)
                 goto vm_throw;
 
-            r[r0].u.jsValue = result;
+            r[dst].u.jsValue = result;
             
             ++vPC;
             NEXT_OPCODE;
@@ -1830,7 +1830,7 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
         // this instruction as a normal function call, supplying the proper 'this'
         // value.
         vPC -= 5;
-        r[r2].u.jsValue = base->toObject(exec)->toThisObject(exec);
+        r[base].u.jsValue = baseVal->toObject(exec)->toThisObject(exec);
 
 #if HAVE(COMPUTED_GOTO)
         // Hack around gcc performance quirk by performing an indirect goto
@@ -1841,13 +1841,13 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
         // fall through to op_call
     }
     BEGIN_OPCODE(op_call) {
-        int r0 = (++vPC)->u.operand;
-        int r1 = (++vPC)->u.operand;
-        int r2 = (++vPC)->u.operand;
+        int dst = (++vPC)->u.operand;
+        int func = (++vPC)->u.operand;
+        int base = (++vPC)->u.operand;
         int argv = (++vPC)->u.operand;
         int argc = (++vPC)->u.operand;
         
-        JSValue* v = r[r1].u.jsValue;
+        JSValue* v = r[func].u.jsValue;
         
         CallData callData;
         CallType callType = v->getCallData(callData);
@@ -1857,8 +1857,8 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
             Register* callFrame = r + argv - CallFrameHeaderSize;
             int callFrameOffset = registerOffset + argv - CallFrameHeaderSize;
 
-            r[argv].u.jsValue = r2 == missingThisObjectMarker() ? exec->globalThisValue() : r[r2].u.jsValue; // "this" value
-            initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, registerOffset, r0, argv, argc, 0, v);
+            r[argv].u.jsValue = base == missingThisObjectMarker() ? exec->globalThisValue() : r[base].u.jsValue; // "this" value
+            initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, registerOffset, dst, argv, argc, 0, v);
 
             ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
             FunctionBodyNode* functionBodyNode = callData.js.functionBody;
@@ -1880,7 +1880,7 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
         if (callType == CallTypeNative) {
             int registerOffset = r - (*registerBase);
             
-            r[argv].u.jsValue = r2 == missingThisObjectMarker() ? exec->globalThisValue() : (r[r2].u.jsValue)->toObject(exec); // "this" value
+            r[argv].u.jsValue = base == missingThisObjectMarker() ? exec->globalThisValue() : (r[base].u.jsValue)->toObject(exec); // "this" value
             JSObject* thisObj = static_cast<JSObject*>(r[argv].u.jsValue);
 
             List args(&r[argv + 1].u.jsValue, argc - 1);
@@ -1890,7 +1890,7 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
             registerFile->setSafeForReentry(false);
 
             r = (*registerBase) + registerOffset;
-            r[r0].u.jsValue = returnValue;
+            r[dst].u.jsValue = returnValue;
 
             VM_CHECK_EXCEPTION();
 
@@ -1941,18 +1941,18 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
         NEXT_OPCODE;
     }
     BEGIN_OPCODE(op_construct) {
-        int r0 = (++vPC)->u.operand;
-        int r1 = (++vPC)->u.operand;
+        int dst = (++vPC)->u.operand;
+        int func = (++vPC)->u.operand;
         int argv = (++vPC)->u.operand;
         int argc = (++vPC)->u.operand;
 
-        JSValue* v = r[r1].u.jsValue;
+        JSValue* funcVal = r[func].u.jsValue;
 
         ConstructData constructData;
-        ConstructType constructType = v->getConstructData(constructData);
+        ConstructType constructType = funcVal->getConstructData(constructData);
 
         // Removing this line of code causes a measurable regression on squirrelfish.
-        JSObject* constructor = static_cast<JSObject*>(v);
+        JSObject* constructor = static_cast<JSObject*>(funcVal);
 
         if (constructType == ConstructTypeJS) {
             int registerOffset = r - (*registerBase);
@@ -1968,8 +1968,8 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
             JSObject* newObject = new JSObject(prototype);
             r[argv].u.jsValue = newObject; // "this" value
 
-            initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, registerOffset, r0, argv, argc, 1, constructor);
-            
+            initializeCallFrame(callFrame, codeBlock, vPC, scopeChain, registerOffset, dst, argv, argc, 1, constructor);
+
             ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
             FunctionBodyNode* functionBodyNode = constructData.js.functionBody;
 
@@ -1994,18 +1994,18 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
             registerFile->setSafeForReentry(true);
             JSValue* returnValue = constructor->construct(exec, args);
             registerFile->setSafeForReentry(false);
-        
+
             r = (*registerBase) + registerOffset;
             VM_CHECK_EXCEPTION();
-            r[r0].u.jsValue = returnValue;
-            
+            r[dst].u.jsValue = returnValue;
+
             ++vPC;
             NEXT_OPCODE;
         }
 
         ASSERT(constructType == ConstructTypeNone);
 
-        exceptionValue = createNotAConstructorError(exec, v, 0);
+        exceptionValue = createNotAConstructorError(exec, funcVal, 0);
         goto vm_throw;
     }
     BEGIN_OPCODE(op_push_scope) {