Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 2a10a87ac71e3868e344c9cc2a004cf0ef89a372..20a34b3c9159c81508da6016fe0082e282cc442f 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -1016,6 +1016,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; |
+ __ cmpl(left_reg, Immediate(kMinInt)); |
+ __ j(not_zero, &left_not_min_int, Label::kNear); |
+ __ cmpl(right_reg, Immediate(-1)); |
+ DeoptimizeIf(zero, instr->environment()); |
+ __ bind(&left_not_min_int); |
+ } |
+ |
// Sign extend eax to edx. |
// (We are using only the low 32 bits of the values.) |
__ cdq(); |