Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index ca64442270210777fbc1375beb27b63e4ab89151..73f05f5e91c80644f0ce83115162ba364897d523 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -3381,20 +3381,28 @@ void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
scratch2); |
// Deoptimize if we had a vfp invalid exception. |
DeoptimizeIf(ne, instr->environment()); |
+ |
// Retrieve the result. |
__ vmov(result_reg, single_scratch); |
- if (instr->truncating() && |
- instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
- Label done; |
- __ cmp(result_reg, Operand(0)); |
- __ b(ne, &done); |
- // Check for -0. |
- __ vmov(scratch1, double_input.high()); |
- __ tst(scratch1, Operand(HeapNumber::kSignMask)); |
+ if (!instr->truncating()) { |
+ // Convert result back to double and compare with input |
+ // to check if the conversion was exact. |
+ __ vmov(single_scratch, result_reg); |
+ __ vcvt_f64_s32(double_scratch0(), single_scratch); |
+ __ VFPCompareAndSetFlags(double_scratch0(), double_input); |
DeoptimizeIf(ne, instr->environment()); |
+ if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
+ Label done; |
+ __ cmp(result_reg, Operand(0)); |
+ __ b(ne, &done); |
+ // Check for -0. |
+ __ vmov(scratch1, double_input.high()); |
+ __ tst(scratch1, Operand(HeapNumber::kSignMask)); |
+ DeoptimizeIf(ne, instr->environment()); |
- __ bind(&done); |
+ __ bind(&done); |
+ } |
} |
} |