Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index f766ba47624518537ba3dba11f2d58ee16f9123b..b174a0e24a62c0eb98eb887673f821a30ef9496f 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -1310,7 +1310,7 @@ LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) { |
} |
-LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) { |
+LInstruction* LChunkBuilder::DoDivI(HDiv* instr) { |
ASSERT(instr->representation().IsSmiOrInteger32()); |
ASSERT(instr->left()->representation().Equals(instr->representation())); |
ASSERT(instr->right()->representation().Equals(instr->representation())); |
@@ -1322,8 +1322,7 @@ LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) { |
if (instr->CheckFlag(HValue::kCanBeDivByZero) || |
instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
instr->CheckFlag(HValue::kCanOverflow) || |
- (!instr->IsMathFloorOfDiv() && |
- !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) { |
+ !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) { |
result = AssignEnvironment(result); |
} |
return result; |
@@ -1387,13 +1386,31 @@ LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { |
} |
+LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) { |
+ ASSERT(instr->representation().IsSmiOrInteger32()); |
+ ASSERT(instr->left()->representation().Equals(instr->representation())); |
+ ASSERT(instr->right()->representation().Equals(instr->representation())); |
+ LOperand* dividend = UseFixed(instr->left(), rax); |
+ LOperand* divisor = UseRegister(instr->right()); |
+ LOperand* temp = FixedTemp(rdx); |
+ LInstruction* result = DefineFixed(new(zone()) LFlooringDivI( |
+ dividend, divisor, temp), rax); |
+ if (instr->CheckFlag(HValue::kCanBeDivByZero) || |
+ instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
+ instr->CheckFlag(HValue::kCanOverflow)) { |
+ result = AssignEnvironment(result); |
+ } |
+ return result; |
+} |
+ |
+ |
LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
if (instr->RightIsPowerOf2()) { |
return DoFlooringDivByPowerOf2I(instr); |
} else if (instr->right()->IsConstant()) { |
return DoFlooringDivByConstI(instr); |
} else { |
- return DoDivI(instr); |
+ return DoFlooringDivI(instr); |
} |
} |