| Index: src/x64/lithium-codegen-x64.cc
|
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
|
| index 41321340e01ca4e302e91291bc54e864e47ee647..809df5d9327435b1022b2bd48a85510f9eccf75f 100644
|
| --- a/src/x64/lithium-codegen-x64.cc
|
| +++ b/src/x64/lithium-codegen-x64.cc
|
| @@ -1134,16 +1134,17 @@ void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
|
| DeoptimizeIf(zero, instr->environment());
|
| }
|
|
|
| - // If the negation could not overflow, simply shifting is OK.
|
| - if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
|
| - __ sarl(dividend, Immediate(shift));
|
| + // Dividing by -1 is basically negation, unless we overflow.
|
| + if (divisor == -1) {
|
| + if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
|
| + DeoptimizeIf(overflow, instr->environment());
|
| + }
|
| return;
|
| }
|
|
|
| - // Note that we could emit branch-free code, but that would need one more
|
| - // register.
|
| - if (divisor == -1) {
|
| - DeoptimizeIf(overflow, instr->environment());
|
| + // If the negation could not overflow, simply shifting is OK.
|
| + if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
|
| + __ sarl(dividend, Immediate(shift));
|
| return;
|
| }
|
|
|
|
|