| Index: src/ia32/lithium-codegen-ia32.cc
|
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
|
| index 0dbe3da13d3f1b4f59bfd2b1f31a1fbaf84c6eaa..2b6db8dfcaaa34982f4fc8ca035c1380cb2940a4 100644
|
| --- a/src/ia32/lithium-codegen-ia32.cc
|
| +++ b/src/ia32/lithium-codegen-ia32.cc
|
| @@ -1629,22 +1629,26 @@ void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
|
| }
|
|
|
| // If the divisor is negative, we have to negate and handle edge cases.
|
| - Label not_kmin_int, done;
|
| __ neg(dividend);
|
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| DeoptimizeIf(zero, instr->environment());
|
| }
|
| - if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
|
| - // Note that we could emit branch-free code, but that would need one more
|
| - // register.
|
| - if (divisor == -1) {
|
| - DeoptimizeIf(overflow, instr->environment());
|
| - } else {
|
| - __ j(no_overflow, ¬_kmin_int, Label::kNear);
|
| - __ mov(dividend, Immediate(kMinInt / divisor));
|
| - __ jmp(&done, Label::kNear);
|
| - }
|
| +
|
| + if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
|
| + __ sar(dividend, shift);
|
| + return;
|
| }
|
| +
|
| + // Dividing by -1 is basically negation, unless we overflow.
|
| + if (divisor == -1) {
|
| + DeoptimizeIf(overflow, instr->environment());
|
| + return;
|
| + }
|
| +
|
| + Label not_kmin_int, done;
|
| + __ j(no_overflow, ¬_kmin_int, Label::kNear);
|
| + __ mov(dividend, Immediate(kMinInt / divisor));
|
| + __ jmp(&done, Label::kNear);
|
| __ bind(¬_kmin_int);
|
| __ sar(dividend, shift);
|
| __ bind(&done);
|
|
|