Changeset 34032 in webkit for trunk/JavaScriptCore
- Timestamp:
- May 22, 2008, 12:55:18 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r34030 r34032 1 2008-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 1 17 2008-05-22 Oliver Hunt <[email protected]> 2 18 -
trunk/JavaScriptCore/VM/CodeGenerator.cpp
r33979 r34032 944 944 } 945 945 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)946 RegisterID* CodeGenerator::emitCall(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode* argumentsNode) 947 { 948 return emitCall(op_call, dst, func, base, argumentsNode); 949 } 950 951 RegisterID* CodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode* argumentsNode) 952 { 953 return emitCall(op_call_eval, dst, func, base, argumentsNode); 954 } 955 956 RegisterID* CodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, RegisterID* base, ArgumentsNode* argumentsNode) 957 957 { 958 958 ASSERT(opcodeID == op_call || opcodeID == op_call_eval); 959 959 960 RefPtr<RegisterID> ref 1 = r1;961 RefPtr<RegisterID> ref 2 = r2;960 RefPtr<RegisterID> refFunc = func; 961 RefPtr<RegisterID> refBase = base; 962 962 963 963 // Reserve space for call frame. … … 975 975 976 976 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. 980 980 instructions().append(argv.size() ? argv[0]->index() : m_temporaries.size()); // argv 981 981 instructions().append(argv.size()); // argc 982 983 return r0; 982 return dst; 984 983 } 985 984 … … 991 990 } 992 991 993 RegisterID* CodeGenerator::emitEnd(RegisterID* r0)992 RegisterID* CodeGenerator::emitEnd(RegisterID* dst) 994 993 { 995 994 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 999 RegisterID* CodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode* argumentsNode) 1001 1000 { 1002 1001 // Reserve space for call frame. … … 1014 1013 1015 1014 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()); 1018 1017 instructions().append(argv.size() ? argv[0]->index() : m_temporaries.size()); // argv 1019 1018 instructions().append(argv.size()); // argc 1020 return r0;1019 return dst; 1021 1020 } 1022 1021 -
trunk/JavaScriptCore/VM/CodeGenerator.h
r33979 r34032 249 249 RegisterID* emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value); 250 250 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*); 253 253 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*); 257 257 258 258 PassRefPtr<LabelID> emitLabel(LabelID*); -
trunk/JavaScriptCore/VM/Machine.cpp
r34009 r34032 1799 1799 } 1800 1800 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; 1804 1804 int argv = (++vPC)->u.operand; 1805 1805 int argc = (++vPC)->u.operand; 1806 1806 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()) { 1811 1811 int registerOffset = r - (*registerBase); 1812 1812 … … 1821 1821 goto vm_throw; 1822 1822 1823 r[ r0].u.jsValue = result;1823 r[dst].u.jsValue = result; 1824 1824 1825 1825 ++vPC; … … 1831 1831 // value. 1832 1832 vPC -= 5; 1833 r[ r2].u.jsValue = base->toObject(exec)->toThisObject(exec);1833 r[base].u.jsValue = baseVal->toObject(exec)->toThisObject(exec); 1834 1834 1835 1835 #if HAVE(COMPUTED_GOTO) … … 1842 1842 } 1843 1843 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; 1847 1847 int argv = (++vPC)->u.operand; 1848 1848 int argc = (++vPC)->u.operand; 1849 1849 1850 JSValue* v = r[ r1].u.jsValue;1850 JSValue* v = r[func].u.jsValue; 1851 1851 1852 1852 CallData callData; … … 1858 1858 int callFrameOffset = registerOffset + argv - CallFrameHeaderSize; 1859 1859 1860 r[argv].u.jsValue = r2 == missingThisObjectMarker() ? exec->globalThisValue() : r[r2].u.jsValue; // "this" value1861 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); 1862 1862 1863 1863 ScopeChainNode* callDataScopeChain = callData.js.scopeChain; … … 1881 1881 int registerOffset = r - (*registerBase); 1882 1882 1883 r[argv].u.jsValue = r2 == missingThisObjectMarker() ? exec->globalThisValue() : (r[r2].u.jsValue)->toObject(exec); // "this" value1883 r[argv].u.jsValue = base == missingThisObjectMarker() ? exec->globalThisValue() : (r[base].u.jsValue)->toObject(exec); // "this" value 1884 1884 JSObject* thisObj = static_cast<JSObject*>(r[argv].u.jsValue); 1885 1885 … … 1891 1891 1892 1892 r = (*registerBase) + registerOffset; 1893 r[ r0].u.jsValue = returnValue;1893 r[dst].u.jsValue = returnValue; 1894 1894 1895 1895 VM_CHECK_EXCEPTION(); … … 1942 1942 } 1943 1943 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; 1946 1946 int argv = (++vPC)->u.operand; 1947 1947 int argc = (++vPC)->u.operand; 1948 1948 1949 JSValue* v = r[r1].u.jsValue;1949 JSValue* funcVal = r[func].u.jsValue; 1950 1950 1951 1951 ConstructData constructData; 1952 ConstructType constructType = v->getConstructData(constructData);1952 ConstructType constructType = funcVal->getConstructData(constructData); 1953 1953 1954 1954 // 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); 1956 1956 1957 1957 if (constructType == ConstructTypeJS) { … … 1969 1969 r[argv].u.jsValue = newObject; // "this" value 1970 1970 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 1973 1973 ScopeChainNode* callDataScopeChain = constructData.js.scopeChain; 1974 1974 FunctionBodyNode* functionBodyNode = constructData.js.functionBody; … … 1995 1995 JSValue* returnValue = constructor->construct(exec, args); 1996 1996 registerFile->setSafeForReentry(false); 1997 1997 1998 1998 r = (*registerBase) + registerOffset; 1999 1999 VM_CHECK_EXCEPTION(); 2000 r[ r0].u.jsValue = returnValue;2001 2000 r[dst].u.jsValue = returnValue; 2001 2002 2002 ++vPC; 2003 2003 NEXT_OPCODE; … … 2006 2006 ASSERT(constructType == ConstructTypeNone); 2007 2007 2008 exceptionValue = createNotAConstructorError(exec, v, 0);2008 exceptionValue = createNotAConstructorError(exec, funcVal, 0); 2009 2009 goto vm_throw; 2010 2010 }
Note:
See TracChangeset
for help on using the changeset viewer.