Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 791faa2660a3517911c2edb926543349408745c9..1e4f7561be995bdb27f7cf8b69c24b1edd1752f5 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -1353,14 +1353,17 @@ void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { |
DeoptimizeIf(zero, instr->environment()); |
} |
- if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { |
- __ sar(dividend, shift); |
+ // Dividing by -1 is basically negation, unless we overflow. |
+ if (divisor == -1) { |
+ if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { |
+ DeoptimizeIf(overflow, instr->environment()); |
+ } |
return; |
} |
- // Dividing by -1 is basically negation, unless we overflow. |
- if (divisor == -1) { |
- DeoptimizeIf(overflow, instr->environment()); |
+ // If the negation could not overflow, simply shifting is OK. |
+ if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { |
+ __ sar(dividend, shift); |
return; |
} |