summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/jit/JITArithmetic.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
commitdd91e772430dc294e3bf478c119ef8d43c0a3358 (patch)
tree6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/JavaScriptCore/jit/JITArithmetic.cpp
parentad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff)
downloadqtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/JavaScriptCore/jit/JITArithmetic.cpp')
-rw-r--r--Source/JavaScriptCore/jit/JITArithmetic.cpp60
1 files changed, 48 insertions, 12 deletions
diff --git a/Source/JavaScriptCore/jit/JITArithmetic.cpp b/Source/JavaScriptCore/jit/JITArithmetic.cpp
index 362cc6241..1b32e3bcf 100644
--- a/Source/JavaScriptCore/jit/JITArithmetic.cpp
+++ b/Source/JavaScriptCore/jit/JITArithmetic.cpp
@@ -192,6 +192,42 @@ void JIT::emitSlow_op_jngreatereq(Instruction* currentInstruction, Vector<SlowCa
#if USE(JSVALUE64)
+void JIT::emit_op_negate(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src = currentInstruction[2].u.operand;
+
+ emitGetVirtualRegister(src, regT0);
+
+ Jump srcNotInt = emitJumpIfNotImmediateInteger(regT0);
+ addSlowCase(branchTest32(Zero, regT0, TrustedImm32(0x7fffffff)));
+ neg32(regT0);
+ emitFastArithReTagImmediate(regT0, regT0);
+
+ Jump end = jump();
+
+ srcNotInt.link(this);
+ emitJumpSlowCaseIfNotImmediateNumber(regT0);
+
+ move(TrustedImmPtr(reinterpret_cast<void*>(0x8000000000000000ull)), regT1);
+ xorPtr(regT1, regT0);
+
+ end.link(this);
+ emitPutVirtualRegister(dst);
+}
+
+void JIT::emitSlow_op_negate(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter); // 0x7fffffff check
+ linkSlowCase(iter); // double check
+
+ JITStubCall stubCall(this, cti_op_negate);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.call(dst);
+}
+
void JIT::emit_op_lshift(Instruction* currentInstruction)
{
unsigned result = currentInstruction[1].u.operand;
@@ -797,13 +833,13 @@ void JIT::compileBinaryArithOp(OpcodeID opcodeID, unsigned, unsigned op1, unsign
addSlowCase(branchMul32(Overflow, regT1, regT2));
JumpList done;
done.append(branchTest32(NonZero, regT2));
- Jump negativeZero = branch32(LessThan, regT0, Imm32(0));
- done.append(branch32(GreaterThanOrEqual, regT1, Imm32(0)));
+ Jump negativeZero = branch32(LessThan, regT0, TrustedImm32(0));
+ done.append(branch32(GreaterThanOrEqual, regT1, TrustedImm32(0)));
negativeZero.link(this);
// We only get here if we have a genuine negative zero. Record this,
// so that the speculative JIT knows that we failed speculation
// because of a negative zero.
- add32(Imm32(1), AbsoluteAddress(&profile->m_counter));
+ add32(TrustedImm32(1), AbsoluteAddress(&profile->m_counter));
addSlowCase(jump());
done.link(this);
move(regT2, regT0);
@@ -927,13 +963,13 @@ void JIT::emit_op_add(Instruction* currentInstruction)
if (isOperandConstantImmediateInt(op1)) {
emitGetVirtualRegister(op2, regT0);
emitJumpSlowCaseIfNotImmediateInteger(regT0);
- addSlowCase(branchAdd32(Overflow, Imm32(getConstantOperandImmediateInt(op1)), regT0));
- emitFastArithIntToImmNoCheck(regT0, regT0);
+ addSlowCase(branchAdd32(Overflow, regT0, Imm32(getConstantOperandImmediateInt(op1)), regT1));
+ emitFastArithIntToImmNoCheck(regT1, regT0);
} else if (isOperandConstantImmediateInt(op2)) {
emitGetVirtualRegister(op1, regT0);
emitJumpSlowCaseIfNotImmediateInteger(regT0);
- addSlowCase(branchAdd32(Overflow, Imm32(getConstantOperandImmediateInt(op2)), regT0));
- emitFastArithIntToImmNoCheck(regT0, regT0);
+ addSlowCase(branchAdd32(Overflow, regT0, Imm32(getConstantOperandImmediateInt(op2)), regT1));
+ emitFastArithIntToImmNoCheck(regT1, regT0);
} else
compileBinaryArithOp(op_add, result, op1, op2, types);
@@ -973,8 +1009,8 @@ void JIT::emit_op_mul(Instruction* currentInstruction)
#endif
emitGetVirtualRegister(op2, regT0);
emitJumpSlowCaseIfNotImmediateInteger(regT0);
- addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT0));
- emitFastArithReTagImmediate(regT0, regT0);
+ addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT1));
+ emitFastArithReTagImmediate(regT1, regT0);
} else if (isOperandConstantImmediateInt(op2) && ((value = getConstantOperandImmediateInt(op2)) > 0)) {
#if ENABLE(VALUE_PROFILER)
// Add a special fast case profile because the DFG JIT will expect one.
@@ -982,8 +1018,8 @@ void JIT::emit_op_mul(Instruction* currentInstruction)
#endif
emitGetVirtualRegister(op1, regT0);
emitJumpSlowCaseIfNotImmediateInteger(regT0);
- addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT0));
- emitFastArithReTagImmediate(regT0, regT0);
+ addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT1));
+ emitFastArithReTagImmediate(regT1, regT0);
} else
compileBinaryArithOp(op_mul, result, op1, op2, types);
@@ -1069,7 +1105,7 @@ void JIT::emit_op_div(Instruction* currentInstruction)
emitFastArithReTagImmediate(regT0, regT0);
Jump isInteger = jump();
notInteger.link(this);
- add32(Imm32(1), AbsoluteAddress(&m_codeBlock->addSpecialFastCaseProfile(m_bytecodeOffset)->m_counter));
+ add32(TrustedImm32(1), AbsoluteAddress(&m_codeBlock->addSpecialFastCaseProfile(m_bytecodeOffset)->m_counter));
moveDoubleToPtr(fpRegT0, regT0);
subPtr(tagTypeNumberRegister, regT0);
isInteger.link(this);