Index: src/a64/lithium-a64.cc |
diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc |
index 1c3b24eba81c6576f08ef3db005e81639bdb269d..c5501010a5c57fb91a0712e00bdaf02e19a482cf 100644 |
--- a/src/a64/lithium-a64.cc |
+++ b/src/a64/lithium-a64.cc |
@@ -1762,12 +1762,17 @@ LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { |
ASSERT(instr->right()->representation().Equals(instr->representation())); |
LOperand* dividend = UseRegister(instr->left()); |
int32_t divisor = instr->right()->GetInteger32Constant(); |
- LInstruction* result = |
- DefineAsRegister(new(zone()) LFlooringDivByConstI(dividend, divisor)); |
- bool can_deopt = |
- divisor == 0 || |
- (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0); |
- return can_deopt ? AssignEnvironment(result) : result; |
+ LOperand* temp = |
+ ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) || |
+ (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ? |
+ NULL : TempRegister(); |
+ LInstruction* result = DefineAsRegister( |
+ new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); |
+ if (divisor == 0 || |
+ (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { |
+ result = AssignEnvironment(result); |
+ } |
+ return result; |
} |
@@ -1784,8 +1789,8 @@ LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) { |
LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
if (instr->RightIsPowerOf2()) { |
return DoFlooringDivByPowerOf2I(instr); |
- } else if (false && instr->right()->IsConstant()) { |
- return DoFlooringDivByConstI(instr); // TODO(svenpanne) Fix and re-enable. |
+ } else if (instr->right()->IsConstant()) { |
+ return DoFlooringDivByConstI(instr); |
} else { |
return DoFlooringDivI(instr); |
} |