2008-12-12 Gavin Barraclough <barraclough@apple.com>
Reviewed by Geoff Garen.
Remove loop counter 'i' from the JIT generation passes, replace with a member m_bytecodeIndex.
No impact on performance.
* jit/JIT.cpp:
(JSC::JIT::compileOpStrictEq):
(JSC::JIT::emitSlowScriptCheck):
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
(JSC::JIT::privateCompile):
* jit/JIT.h:
(JSC::CallRecord::CallRecord):
(JSC::JmpTable::JmpTable):
(JSC::JIT::emitCTICall):
* jit/JITArithmetic.cpp:
(JSC::JIT::compileBinaryArithOp):
(JSC::JIT::compileBinaryArithOpSlowCase):
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):
* jit/JITInlineMethods.h:
(JSC::JIT::emitGetVirtualRegister):
(JSC::JIT::emitGetVirtualRegisters):
(JSC::JIT::emitNakedCall):
(JSC::JIT::emitCTICall_internal):
(JSC::JIT::emitJumpSlowCaseIfJSCell):
(JSC::JIT::emitJumpSlowCaseIfNotJSCell):
(JSC::JIT::emitJumpSlowCaseIfNotImmNum):
(JSC::JIT::emitJumpSlowCaseIfNotImmNums):
(JSC::JIT::emitFastArithIntToImmOrSlowCase):
(JSC::JIT::addSlowCase):
(JSC::JIT::addJump):
(JSC::JIT::emitJumpSlowToHot):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::compileGetByIdHotPath):
(JSC::JIT::compileGetByIdSlowCase):
(JSC::JIT::compilePutByIdHotPath):
(JSC::JIT::compilePutByIdSlowCase):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@39266 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/jit/JITCall.cpp b/JavaScriptCore/jit/JITCall.cpp
index 9c736b5..d788226 100644
--- a/JavaScriptCore/jit/JITCall.cpp
+++ b/JavaScriptCore/jit/JITCall.cpp
@@ -120,7 +120,7 @@
#if !ENABLE(JIT_OPTIMIZE_CALL)
-void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned i, unsigned)
+void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
{
int dst = instruction[1].u.operand;
int callee = instruction[2].u.operand;
@@ -130,14 +130,14 @@
// Handle eval
Jump wasEval;
if (opcodeID == op_call_eval) {
- emitGetVirtualRegister(callee, X86::ecx, i);
+ emitGetVirtualRegister(callee, X86::ecx);
compileOpCallEvalSetupArgs(instruction);
- emitCTICall(i, Interpreter::cti_op_call_eval);
+ emitCTICall(Interpreter::cti_op_call_eval);
wasEval = jnePtr(ImmPtr(JSImmediate::impossibleValue()), X86::eax);
}
- emitGetVirtualRegister(callee, X86::ecx, i);
+ emitGetVirtualRegister(callee, X86::ecx);
// The arguments have been set up on the hot path for op_call_eval
if (opcodeID == op_call)
compileOpCallSetupArgs(instruction);
@@ -145,14 +145,14 @@
compileOpConstructSetupArgs(instruction);
// Check for JSFunctions.
- emitJumpSlowCaseIfNotJSCell(X86::ecx, i);
- m_slowCases.append(SlowCaseEntry(jnePtr(X86::ecx, ImmPtr(m_interpreter->m_jsFunctionVptr)), i));
+ emitJumpSlowCaseIfNotJSCell(X86::ecx);
+ addSlowCase(jnePtr(X86::ecx, ImmPtr(m_interpreter->m_jsFunctionVptr)));
// First, in the case of a construct, allocate the new object.
if (opcodeID == op_construct) {
- emitCTICall(i, Interpreter::cti_op_construct_JSConstruct);
+ emitCTICall(Interpreter::cti_op_construct_JSConstruct);
emitPutVirtualRegister(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitGetVirtualRegister(callee, X86::ecx, i);
+ emitGetVirtualRegister(callee, X86::ecx);
}
// Speculatively roll the callframe, assuming argCount will match the arity.
@@ -160,7 +160,7 @@
addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), X86::edi);
move(Imm32(argCount), X86::edx);
- emitNakedCall(i, m_interpreter->m_ctiVirtualCall);
+ emitNakedCall(m_interpreter->m_ctiVirtualCall);
if (opcodeID == op_call_eval)
wasEval.link(this);
@@ -173,7 +173,7 @@
#endif
}
-void JIT::compileOpCallSlowCase(Instruction* instruction, unsigned i, Vector<SlowCaseEntry>::iterator& iter, unsigned, OpcodeID opcodeID)
+void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned, OpcodeID opcodeID)
{
int dst = instruction[1].u.operand;
@@ -181,7 +181,7 @@
linkSlowCase(iter);
// This handles host functions
- emitCTICall(i, ((opcodeID == op_construct) ? Interpreter::cti_op_construct_NotJSConstruct : Interpreter::cti_op_call_NotJSFunction));
+ emitCTICall(((opcodeID == op_construct) ? Interpreter::cti_op_construct_NotJSConstruct : Interpreter::cti_op_call_NotJSFunction));
// Put the return value in dst. In the interpreter, op_ret does this.
emitPutVirtualRegister(dst);
@@ -198,7 +198,7 @@
exit(1);
}
-void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned i, unsigned callLinkInfoIndex)
+void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
{
int dst = instruction[1].u.operand;
int callee = instruction[2].u.operand;
@@ -208,20 +208,20 @@
// Handle eval
JmpSrc wasEval;
if (opcodeID == op_call_eval) {
- emitGetVirtualRegister(callee, X86::ecx, i);
+ emitGetVirtualRegister(callee, X86::ecx);
compileOpCallEvalSetupArgs(instruction);
- emitCTICall(i, Interpreter::cti_op_call_eval);
+ emitCTICall(Interpreter::cti_op_call_eval);
__ cmpl_i32r(asInteger(JSImmediate::impossibleValue()), X86::eax);
wasEval = __ jne();
}
// This plants a check for a cached JSFunction value, so we can plant a fast link to the callee.
// This deliberately leaves the callee in ecx, used when setting up the stack frame below
- emitGetVirtualRegister(callee, X86::ecx, i);
+ emitGetVirtualRegister(callee, X86::ecx);
__ cmpl_i32r(asInteger(JSImmediate::impossibleValue()), X86::ecx);
JmpDst addressOfLinkedFunctionCheck = __ label();
- m_slowCases.append(SlowCaseEntry(__ jne(), i));
+ addSlowCase(__ jne());
ASSERT(X86Assembler::getDifferenceBetweenLabels(addressOfLinkedFunctionCheck, __ label()) == repatchOffsetOpCallCall);
m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
@@ -234,9 +234,9 @@
emitPutCTIArg(X86::ecx, 0);
emitPutCTIArgFromVirtualRegister(proto, 12, X86::eax);
- emitCTICall(i, Interpreter::cti_op_construct_JSConstruct);
+ emitCTICall(Interpreter::cti_op_construct_JSConstruct);
emitPutVirtualRegister(thisRegister);
- emitGetVirtualRegister(callee, X86::ecx, i);
+ emitGetVirtualRegister(callee, X86::ecx);
}
// Fast version of stack frame initialization, directly relative to edi.
@@ -250,7 +250,7 @@
__ addl_i32r(registerOffset * sizeof(Register), X86::edi);
// Call to the callee
- m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall(i, reinterpret_cast<void*>(unreachable));
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall(reinterpret_cast<void*>(unreachable));
if (opcodeID == op_call_eval)
__ link(wasEval, __ label());
@@ -263,7 +263,7 @@
#endif
}
-void JIT::compileOpCallSlowCase(Instruction* instruction, unsigned i, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID)
+void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID)
{
int dst = instruction[1].u.operand;
int callee = instruction[2].u.operand;
@@ -286,9 +286,9 @@
// First, in the case of a construct, allocate the new object.
if (opcodeID == op_construct) {
- emitCTICall(i, Interpreter::cti_op_construct_JSConstruct);
+ emitCTICall(Interpreter::cti_op_construct_JSConstruct);
emitPutVirtualRegister(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitGetVirtualRegister(callee, X86::ecx, i);
+ emitGetVirtualRegister(callee, X86::ecx);
}
__ movl_i32r(argCount, X86::edx);
@@ -298,7 +298,7 @@
__ addl_i32r(registerOffset * static_cast<int>(sizeof(Register)), X86::edi);
m_callStructureStubCompilationInfo[callLinkInfoIndex].callReturnLocation =
- emitNakedCall(i, m_interpreter->m_ctiVirtualCallPreLink);
+ emitNakedCall(m_interpreter->m_ctiVirtualCallPreLink);
JmpSrc storeResultForFirstRun = __ jmp();
@@ -322,7 +322,7 @@
__ link(isNotObject, notJSFunctionlabel);
__ link(callLinkFailNotObject, notJSFunctionlabel);
__ link(callLinkFailNotJSFunction, notJSFunctionlabel);
- emitCTICall(i, ((opcodeID == op_construct) ? Interpreter::cti_op_construct_NotJSConstruct : Interpreter::cti_op_call_NotJSFunction));
+ emitCTICall(((opcodeID == op_construct) ? Interpreter::cti_op_construct_NotJSConstruct : Interpreter::cti_op_call_NotJSFunction));
JmpSrc wasNotJSFunction = __ jmp();
// Next, handle JSFunctions...
@@ -330,9 +330,9 @@
// First, in the case of a construct, allocate the new object.
if (opcodeID == op_construct) {
- emitCTICall(i, Interpreter::cti_op_construct_JSConstruct);
+ emitCTICall(Interpreter::cti_op_construct_JSConstruct);
emitPutVirtualRegister(registerOffset - RegisterFile::CallFrameHeaderSize - argCount);
- emitGetVirtualRegister(callee, X86::ecx, i);
+ emitGetVirtualRegister(callee, X86::ecx);
}
// Speculatively roll the callframe, assuming argCount will match the arity.
@@ -340,7 +340,7 @@
__ addl_i32r(registerOffset * static_cast<int>(sizeof(Register)), X86::edi);
__ movl_i32r(argCount, X86::edx);
- emitNakedCall(i, m_interpreter->m_ctiVirtualCall);
+ emitNakedCall(m_interpreter->m_ctiVirtualCall);
// Put the return value in dst. In the interpreter, op_ret does this.
JmpDst storeResult = __ label();