Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 0c05252cf3f319da3755e199f6728f127986ff3c..2b6c0a8407e79df676f5ff667ffc4309afa65ea1 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -1458,38 +1458,36 @@ void LCodeGen::DoMultiplySubD(LMultiplySubD* instr) { |
void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { |
Register dividend = ToRegister(instr->dividend()); |
+ Register result = ToRegister(instr->result()); |
int32_t divisor = instr->divisor(); |
- ASSERT(dividend.is(ToRegister(instr->result()))); |
// If the divisor is positive, things are easy: There can be no deopts and we |
// can simply do an arithmetic right shift. |
if (divisor == 1) return; |
int32_t shift = WhichPowerOf2Abs(divisor); |
if (divisor > 1) { |
- __ mov(dividend, Operand(dividend, ASR, shift)); |
+ __ mov(result, Operand(dividend, ASR, shift)); |
return; |
} |
// If the divisor is negative, we have to negate and handle edge cases. |
- Label not_kmin_int, done; |
- __ rsb(dividend, dividend, Operand::Zero(), SetCC); |
+ __ rsb(result, dividend, Operand::Zero(), SetCC); |
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
DeoptimizeIf(eq, instr->environment()); |
} |
- if (instr->hydrogen()->left()->RangeCanInclude(kMinInt)) { |
+ if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { |
// Note that we could emit branch-free code, but that would need one more |
// register. |
- __ b(vc, ¬_kmin_int); |
if (divisor == -1) { |
- DeoptimizeIf(al, instr->environment()); |
+ DeoptimizeIf(vs, instr->environment()); |
+ __ mov(result, Operand(dividend, ASR, shift)); |
} else { |
- __ mov(dividend, Operand(kMinInt / divisor)); |
- __ b(&done); |
+ __ mov(result, Operand(kMinInt / divisor), LeaveCC, vs); |
+ __ mov(result, Operand(dividend, ASR, shift), LeaveCC, vc); |
} |
+ } else { |
+ __ mov(result, Operand(dividend, ASR, shift)); |
} |
- __ bind(¬_kmin_int); |
- __ mov(dividend, Operand(dividend, ASR, shift)); |
- __ bind(&done); |
} |