summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Brianceau <jbriance@cisco.com>2014-06-06 11:44:40 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-06 12:46:39 +0200
commit37b5139f0dda69158875307bb9f806c3809b80ff (patch)
treef0a617c4551ec166fd0320cdc53e008d4cafe4a3
parent2d9ed318a21f6102dddc0b91de2698908a9b8efc (diff)
Prevent register clobbering to fix negative zero check in SoftModulo.
This fix is not relevant for x86 architectures. Covered by integer-division-neg2tothe32-by-neg1 JavaScript test. Change-Id: I8ffd1280063305bc98c564f5df57c76cc5b1d7a6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
-rw-r--r--Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
index 325a876a2..1348f94be 100644
--- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
+++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
@@ -3051,7 +3051,13 @@ void SpeculativeJIT::compileSoftModulo(Node* node)
FPRResult result(this);
flushRegisters();
- callOperation(operationFModOnInts, result.fpr(), op1GPR, op2GPR);
+ if (!nodeCanIgnoreNegativeZero(node->arithNodeFlags())) {
+ // NegativeZero check will need op1GPR and fmod call is likely to clobber it.
+ m_jit.push(op1GPR);
+ callOperation(operationFModOnInts, result.fpr(), op1GPR, op2GPR);
+ m_jit.pop(op1GPR);
+ } else
+ callOperation(operationFModOnInts, result.fpr(), op1GPR, op2GPR);
FPRTemporary scratch(this);
GPRTemporary intResult(this);