Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index b2ce5203c511d096b7f300c290100aea80418d26..bc3eed526c9bcba04914269cd5b88f492c0f52b8 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -1168,6 +1168,17 @@ void LCodeGen::DoModI(LModI* instr) { |
// Slow case, using idiv instruction. |
__ bind(&slow); |
+ |
+ // Check for (kMinInt % -1). |
+ if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
+ Label left_not_min_int; |
+ __ cmp(left_reg, kMinInt); |
+ __ j(not_zero, &left_not_min_int, Label::kNear); |
+ __ cmp(right_reg, -1); |
+ DeoptimizeIf(zero, instr->environment()); |
+ __ bind(&left_not_min_int); |
+ } |
+ |
// Sign extend to edx. |
__ cdq(); |