Index: src/ia32/lithium-ia32.cc |
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
index 39079d338927b11bf32cada962334653dd9a0484..d5cf125eb0b8e6abab408489d494cecae76f16d9 100644 |
--- a/src/ia32/lithium-ia32.cc |
+++ b/src/ia32/lithium-ia32.cc |
@@ -1145,7 +1145,16 @@ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
input); |
return MarkAsCall(DefineFixedDouble(result, xmm1), instr); |
} else { |
- LOperand* input = UseRegisterAtStart(instr->value()); |
+ LOperand* input; |
+ if (op == kMathRound && |
+ (!CpuFeatures::IsSupported(SSE4_1) || |
+ instr->CheckFlag(HValue::kBailoutOnMinusZero))) { |
+ // Math.round implemented without roundsd. Input may be overwritten. |
+ ASSERT(instr->value()->representation().IsDouble()); |
+ input = UseTempRegister(instr->value()); |
+ } else { |
+ input = UseRegisterAtStart(instr->value()); |
+ } |
LOperand* context = UseAny(instr->context()); // Deferred use by MathAbs. |
if (op == kMathPowHalf) { |
LOperand* temp = TempRegister(); |