summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/jit
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/jit')
-rw-r--r--JavaScriptCore/jit/JIT.cpp2
-rw-r--r--JavaScriptCore/jit/JITArithmetic.cpp12
-rw-r--r--JavaScriptCore/jit/JITOpcodes.cpp82
-rw-r--r--JavaScriptCore/jit/JITOpcodes32_64.cpp90
-rw-r--r--JavaScriptCore/jit/JITStubs.cpp29
5 files changed, 105 insertions, 110 deletions
diff --git a/JavaScriptCore/jit/JIT.cpp b/JavaScriptCore/jit/JIT.cpp
index 3f2ec59..01401a7 100644
--- a/JavaScriptCore/jit/JIT.cpp
+++ b/JavaScriptCore/jit/JIT.cpp
@@ -552,7 +552,7 @@ JITCode JIT::privateCompile(CodePtr* functionEntryArityCheck)
patchBuffer.link(iter->from, FunctionPtr(iter->to));
}
- if (m_codeBlock->hasExceptionInfo()) {
+ if (m_codeBlock->needsCallReturnIndices()) {
m_codeBlock->callReturnIndexVector().reserveCapacity(m_calls.size());
for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter)
m_codeBlock->callReturnIndexVector().append(CallReturnOffsetToBytecodeOffset(patchBuffer.returnAddressOffset(iter->from), iter->bytecodeOffset));
diff --git a/JavaScriptCore/jit/JITArithmetic.cpp b/JavaScriptCore/jit/JITArithmetic.cpp
index f0a049a..cd05f51 100644
--- a/JavaScriptCore/jit/JITArithmetic.cpp
+++ b/JavaScriptCore/jit/JITArithmetic.cpp
@@ -916,22 +916,10 @@ void JIT::emit_op_mod(Instruction* currentInstruction)
unsigned op1 = currentInstruction[2].u.operand;
unsigned op2 = currentInstruction[3].u.operand;
-#if ENABLE(JIT_USE_SOFT_MODULO)
- emitGetVirtualRegisters(op1, regT0, op2, regT2);
- emitJumpSlowCaseIfNotImmediateInteger(regT0);
- emitJumpSlowCaseIfNotImmediateInteger(regT2);
-
- addSlowCase(branch32(Equal, regT2, Imm32(1)));
-
- emitNakedCall(m_globalData->jitStubs->ctiSoftModulo());
-
- emitPutVirtualRegister(result, regT0);
-#else
JITStubCall stubCall(this, cti_op_mod);
stubCall.addArgument(op1, regT2);
stubCall.addArgument(op2, regT2);
stubCall.call(result);
-#endif
}
void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
diff --git a/JavaScriptCore/jit/JITOpcodes.cpp b/JavaScriptCore/jit/JITOpcodes.cpp
index d783581..66285ae 100644
--- a/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/JavaScriptCore/jit/JITOpcodes.cpp
@@ -46,10 +46,6 @@ namespace JSC {
void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, TrampolineStructure *trampolines)
{
-#if ENABLE(JIT_USE_SOFT_MODULO)
- Label softModBegin = align();
- softModulo();
-#endif
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
// (2) The second function provides fast property access for string length
Label stringLengthBegin = align();
@@ -185,9 +181,6 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
trampolines->ctiVirtualConstruct = patchBuffer.trampolineAt(virtualConstructBegin);
trampolines->ctiNativeCall = patchBuffer.trampolineAt(nativeCallThunk);
trampolines->ctiNativeConstruct = patchBuffer.trampolineAt(nativeConstructThunk);
-#if ENABLE(JIT_USE_SOFT_MODULO)
- trampolines->ctiSoftModulo = patchBuffer.trampolineAt(softModBegin);
-#endif
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
trampolines->ctiStringLengthTrampoline = patchBuffer.trampolineAt(stringLengthBegin);
#endif
@@ -1777,81 +1770,6 @@ void JIT::emit_op_new_func(Instruction* currentInstruction)
lazyJump.link(this);
}
-// For both JSValue32_64 and JSValue32
-#if ENABLE(JIT_USE_SOFT_MODULO)
-#if CPU(ARM_TRADITIONAL)
-void JIT::softModulo()
-{
- push(regS0);
- push(regS1);
- push(regT1);
- push(regT3);
-#if USE(JSVALUE32_64)
- m_assembler.mov_r(regT3, regT2);
- m_assembler.mov_r(regT2, regT0);
-#else
- m_assembler.mov_r(regT3, m_assembler.asr(regT2, 1));
- m_assembler.mov_r(regT2, m_assembler.asr(regT0, 1));
-#endif
- m_assembler.mov_r(regT1, ARMAssembler::getOp2(0));
-
- m_assembler.teq_r(regT3, ARMAssembler::getOp2(0));
- m_assembler.rsb_r(regT3, regT3, ARMAssembler::getOp2(0), ARMAssembler::MI);
- m_assembler.eor_r(regT1, regT1, ARMAssembler::getOp2(1), ARMAssembler::MI);
-
- m_assembler.teq_r(regT2, ARMAssembler::getOp2(0));
- m_assembler.rsb_r(regT2, regT2, ARMAssembler::getOp2(0), ARMAssembler::MI);
- m_assembler.eor_r(regT1, regT1, ARMAssembler::getOp2(2), ARMAssembler::MI);
-
- Jump exitBranch = branch32(LessThan, regT2, regT3);
-
- m_assembler.sub_r(regS1, regT3, ARMAssembler::getOp2(1));
- m_assembler.tst_r(regS1, regT3);
- m_assembler.and_r(regT2, regT2, regS1, ARMAssembler::EQ);
- m_assembler.and_r(regT0, regS1, regT3);
- Jump exitBranch2 = branchTest32(Zero, regT0);
-
- m_assembler.clz_r(regS1, regT2);
- m_assembler.clz_r(regS0, regT3);
- m_assembler.sub_r(regS0, regS0, regS1);
-
- m_assembler.rsbs_r(regS0, regS0, ARMAssembler::getOp2(31));
-
- m_assembler.mov_r(regS0, m_assembler.lsl(regS0, 1), ARMAssembler::NE);
-
- m_assembler.add_r(ARMRegisters::pc, ARMRegisters::pc, m_assembler.lsl(regS0, 2), ARMAssembler::NE);
- m_assembler.mov_r(regT0, regT0);
-
- for (int i = 31; i > 0; --i) {
- m_assembler.cmp_r(regT2, m_assembler.lsl(regT3, i));
- m_assembler.sub_r(regT2, regT2, m_assembler.lsl(regT3, i), ARMAssembler::CS);
- }
-
- m_assembler.cmp_r(regT2, regT3);
- m_assembler.sub_r(regT2, regT2, regT3, ARMAssembler::CS);
-
- exitBranch.link(this);
- exitBranch2.link(this);
-
- m_assembler.teq_r(regT1, ARMAssembler::getOp2(0));
- m_assembler.rsb_r(regT2, regT2, ARMAssembler::getOp2(0), ARMAssembler::GT);
-
-#if USE(JSVALUE32_64)
- m_assembler.mov_r(regT0, regT2);
-#else
- m_assembler.mov_r(regT0, m_assembler.lsl(regT2, 1));
- m_assembler.eor_r(regT0, regT0, ARMAssembler::getOp2(1));
-#endif
- pop(regT3);
- pop(regT1);
- pop(regS1);
- pop(regS0);
- ret();
-}
-#else
-#error "JIT_OPTIMIZE_MOD not yet supported on this platform."
-#endif // CPU(ARM_TRADITIONAL)
-#endif
} // namespace JSC
#endif // ENABLE(JIT)
diff --git a/JavaScriptCore/jit/JITOpcodes32_64.cpp b/JavaScriptCore/jit/JITOpcodes32_64.cpp
index 076649d..a2bb159 100644
--- a/JavaScriptCore/jit/JITOpcodes32_64.cpp
+++ b/JavaScriptCore/jit/JITOpcodes32_64.cpp
@@ -1740,6 +1740,96 @@ void JIT::emitSlow_op_get_argument_by_val(Instruction* currentInstruction, Vecto
stubCall.call(dst);
}
+#if ENABLE(JIT_USE_SOFT_MODULO)
+void JIT::softModulo()
+{
+ push(regT1);
+ push(regT3);
+ move(regT2, regT3);
+ move(regT0, regT2);
+ move(Imm32(0), regT1);
+
+ // Check for negative result reminder
+ Jump positiveRegT3 = branch32(GreaterThanOrEqual, regT3, Imm32(0));
+ neg32(regT3);
+ xor32(Imm32(1), regT1);
+ positiveRegT3.link(this);
+
+ Jump positiveRegT2 = branch32(GreaterThanOrEqual, regT2, Imm32(0));
+ neg32(regT2);
+ xor32(Imm32(2), regT1);
+ positiveRegT2.link(this);
+
+ // Save the condition for negative reminder
+ push(regT1);
+
+ Jump exitBranch = branch32(LessThan, regT2, regT3);
+
+ // Power of two fast case
+ move(regT3, regT0);
+ sub32(Imm32(1), regT0);
+ Jump powerOfTwo = branchTest32(NotEqual, regT0, regT3);
+ and32(regT0, regT2);
+ powerOfTwo.link(this);
+
+ and32(regT3, regT0);
+
+ Jump exitBranch2 = branchTest32(Zero, regT0);
+
+ countLeadingZeros32(regT2, regT0);
+ countLeadingZeros32(regT3, regT1);
+ sub32(regT0, regT1);
+
+ Jump useFullTable = branch32(Equal, regT1, Imm32(31));
+
+ neg32(regT1);
+ add32(Imm32(31), regT1);
+
+ int elementSizeByShift = -1;
+#if CPU(ARM)
+ elementSizeByShift = 3;
+#else
+#error "JIT_OPTIMIZE_MOD not yet supported on this platform."
+#endif
+ relativeTableJump(regT1, elementSizeByShift);
+
+ useFullTable.link(this);
+ // Modulo table
+ for (int i = 31; i > 0; --i) {
+#if CPU(ARM_TRADITIONAL)
+ m_assembler.cmp_r(regT2, m_assembler.lsl(regT3, i));
+ m_assembler.sub_r(regT2, regT2, m_assembler.lsl(regT3, i), ARMAssembler::CS);
+#elif CPU(ARM_THUMB2)
+ ShiftTypeAndAmount shift(SRType_LSL, i);
+ m_assembler.sub_S(regT1, regT2, regT3, shift);
+ m_assembler.it(ARMv7Assembler::ConditionCS);
+ m_assembler.mov(regT2, regT1);
+#else
+#error "JIT_OPTIMIZE_MOD not yet supported on this platform."
+#endif
+ }
+
+ Jump lower = branch32(Below, regT2, regT3);
+ sub32(regT3, regT2);
+ lower.link(this);
+
+ exitBranch.link(this);
+ exitBranch2.link(this);
+
+ // Check for negative reminder
+ pop(regT1);
+ Jump positiveResult = branch32(Equal, regT1, Imm32(0));
+ neg32(regT2);
+ positiveResult.link(this);
+
+ move(regT2, regT0);
+
+ pop(regT3);
+ pop(regT1);
+ ret();
+}
+#endif // ENABLE(JIT_USE_SOFT_MODULO)
+
} // namespace JSC
#endif // USE(JSVALUE32_64)
diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp
index 36d36a2..097d55b 100644
--- a/JavaScriptCore/jit/JITStubs.cpp
+++ b/JavaScriptCore/jit/JITStubs.cpp
@@ -801,7 +801,6 @@ JITThunks::JITThunks(JSGlobalData* globalData)
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, registerFile) == REGISTER_FILE_OFFSET);
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, callFrame) == CALLFRAME_OFFSET);
- ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, exception) == EXCEPTION_OFFSET);
// The fifth argument is the first item already on the stack.
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == ENABLE_PROFILER_REFERENCE_OFFSET);
@@ -1067,13 +1066,13 @@ struct ExceptionHandler {
void* catchRoutine;
CallFrame* callFrame;
};
-static ExceptionHandler jitThrow(JSGlobalData* globalData, CallFrame* callFrame, JSValue exceptionValue, ReturnAddressPtr faultLocation, bool explicitThrow)
+static ExceptionHandler jitThrow(JSGlobalData* globalData, CallFrame* callFrame, JSValue exceptionValue, ReturnAddressPtr faultLocation)
{
ASSERT(exceptionValue);
- unsigned vPCIndex = callFrame->codeBlock()->bytecodeOffset(callFrame, faultLocation);
+ unsigned vPCIndex = callFrame->codeBlock()->bytecodeOffset(faultLocation);
globalData->exception = JSValue();
- HandlerInfo* handler = globalData->interpreter->throwException(callFrame, exceptionValue, vPCIndex, explicitThrow); // This may update callFrame & exceptionValue!
+ HandlerInfo* handler = globalData->interpreter->throwException(callFrame, exceptionValue, vPCIndex); // This may update callFrame & exceptionValue!
globalData->exception = exceptionValue;
void* catchRoutine = handler ? handler->nativeCode.executableAddress() : FunctionPtr(ctiOpThrowNotCaught).value();
@@ -1384,7 +1383,7 @@ DEFINE_STUB_FUNCTION(void*, register_file_check)
// Rewind to the previous call frame because op_call already optimistically
// moved the call frame forward.
CallFrame* oldCallFrame = callFrame->callerFrame();
- ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), ReturnAddressPtr(oldCallFrame->returnPC()), false);
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), ReturnAddressPtr(oldCallFrame->returnPC()));
STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
callFrame = handler.callFrame;
}
@@ -1937,7 +1936,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_func)
{
STUB_INIT_STACK_FRAME(stackFrame);
- ASSERT(stackFrame.callFrame->codeBlock()->codeType() != FunctionCode || !stackFrame.callFrame->codeBlock()->needsFullScopeChain() || stackFrame.callFrame->r(stackFrame.callFrame->codeBlock()->activationRegister()).jsValue());
+ ASSERT(stackFrame.callFrame->codeBlock()->codeType() != FunctionCode || !stackFrame.callFrame->codeBlock()->needsFullScopeChain() || stackFrame.callFrame->uncheckedR(stackFrame.callFrame->codeBlock()->activationRegister()).jsValue());
return stackFrame.args[0].function()->make(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
}
@@ -2006,7 +2005,7 @@ DEFINE_STUB_FUNCTION(void*, op_call_arityCheck)
if (!stackFrame.registerFile->grow(newEnd)) {
// Rewind to the previous call frame because op_call already optimistically
// moved the call frame forward.
- ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc, false);
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc);
STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
return handler.callFrame;
}
@@ -2021,7 +2020,7 @@ DEFINE_STUB_FUNCTION(void*, op_call_arityCheck)
if (!stackFrame.registerFile->grow(newEnd)) {
// Rewind to the previous call frame because op_call already optimistically
// moved the call frame forward.
- ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc, false);
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc);
STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
return handler.callFrame;
}
@@ -2065,7 +2064,7 @@ DEFINE_STUB_FUNCTION(void*, op_construct_arityCheck)
if (!stackFrame.registerFile->grow(newEnd)) {
// Rewind to the previous call frame because op_call already optimistically
// moved the call frame forward.
- ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc, false);
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc);
STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
return handler.callFrame;
}
@@ -2080,7 +2079,7 @@ DEFINE_STUB_FUNCTION(void*, op_construct_arityCheck)
if (!stackFrame.registerFile->grow(newEnd)) {
// Rewind to the previous call frame because op_call already optimistically
// moved the call frame forward.
- ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc, false);
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc);
STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
return handler.callFrame;
}
@@ -2741,7 +2740,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_skip)
bool checkTopLevel = codeBlock->codeType() == FunctionCode && codeBlock->needsFullScopeChain();
ASSERT(skip || !checkTopLevel);
if (checkTopLevel && skip--) {
- if (callFrame->r(codeBlock->activationRegister()).jsValue())
+ if (callFrame->uncheckedR(codeBlock->activationRegister()).jsValue())
++iter;
}
while (skip--) {
@@ -3103,7 +3102,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_func_exp)
FunctionExecutable* function = stackFrame.args[0].function();
JSFunction* func = function->make(callFrame, callFrame->scopeChain());
- ASSERT(callFrame->codeBlock()->codeType() != FunctionCode || !callFrame->codeBlock()->needsFullScopeChain() || callFrame->r(callFrame->codeBlock()->activationRegister()).jsValue());
+ ASSERT(callFrame->codeBlock()->codeType() != FunctionCode || !callFrame->codeBlock()->needsFullScopeChain() || callFrame->uncheckedR(callFrame->codeBlock()->activationRegister()).jsValue());
/*
The Identifier in a FunctionExpression can be referenced from inside
@@ -3210,7 +3209,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_bitor)
DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_eval)
{
STUB_INIT_STACK_FRAME(stackFrame);
- ASSERT(stackFrame.callFrame->codeBlock()->codeType() != FunctionCode || !stackFrame.callFrame->codeBlock()->needsFullScopeChain() || stackFrame.callFrame->r(stackFrame.callFrame->codeBlock()->activationRegister()).jsValue());
+ ASSERT(stackFrame.callFrame->codeBlock()->codeType() != FunctionCode || !stackFrame.callFrame->codeBlock()->needsFullScopeChain() || stackFrame.callFrame->uncheckedR(stackFrame.callFrame->codeBlock()->activationRegister()).jsValue());
CallFrame* callFrame = stackFrame.callFrame;
RegisterFile* registerFile = stackFrame.registerFile;
@@ -3238,7 +3237,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_eval)
DEFINE_STUB_FUNCTION(void*, op_throw)
{
STUB_INIT_STACK_FRAME(stackFrame);
- ExceptionHandler handler = jitThrow(stackFrame.globalData, stackFrame.callFrame, stackFrame.args[0].jsValue(), STUB_RETURN_ADDRESS, true);
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, stackFrame.callFrame, stackFrame.args[0].jsValue(), STUB_RETURN_ADDRESS);
STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
return handler.callFrame;
}
@@ -3595,7 +3594,7 @@ DEFINE_STUB_FUNCTION(void*, vm_throw)
{
STUB_INIT_STACK_FRAME(stackFrame);
JSGlobalData* globalData = stackFrame.globalData;
- ExceptionHandler handler = jitThrow(globalData, stackFrame.callFrame, globalData->exception, globalData->exceptionLocation, false);
+ ExceptionHandler handler = jitThrow(globalData, stackFrame.callFrame, globalData->exception, globalData->exceptionLocation);
STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
return handler.callFrame;
}