Index: src/crankshaft/x87/lithium-codegen-x87.cc |
diff --git a/src/crankshaft/x87/lithium-codegen-x87.cc b/src/crankshaft/x87/lithium-codegen-x87.cc |
index 01df131d568858dcaa2095e6623a613b79635089..1283ac075818f1562178738d42f9cb7885f4e0e4 100644 |
--- a/src/crankshaft/x87/lithium-codegen-x87.cc |
+++ b/src/crankshaft/x87/lithium-codegen-x87.cc |
@@ -3480,6 +3480,7 @@ void LCodeGen::DoMathFloor(LMathFloor* instr) { |
__ sub(esp, Immediate(kPointerSize)); |
__ fist_s(Operand(esp, 0)); |
__ pop(output_reg); |
+ __ X87SetRC(0x0000); |
__ X87CheckIA(); |
DeoptimizeIf(equal, instr, Deoptimizer::kOverflow); |
__ fnclex(); |
@@ -3512,6 +3513,8 @@ void LCodeGen::DoMathRound(LMathRound* instr) { |
// Clear exception bits. |
__ fnclex(); |
__ fistp_s(MemOperand(esp, 0)); |
+ // Restore round mode. |
+ __ X87SetRC(0x0000); |
// Check overflow. |
__ X87CheckIA(); |
__ pop(result); |
@@ -3546,6 +3549,8 @@ void LCodeGen::DoMathRound(LMathRound* instr) { |
// Clear exception bits. |
__ fnclex(); |
__ fistp_s(MemOperand(esp, 0)); |
+ // Restore round mode. |
+ __ X87SetRC(0x0000); |
// Check overflow. |
__ X87CheckIA(); |
__ pop(result); |