Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 56d850b5890c7aaa35a1aba52ed00bf10fe24bfb..bdb90cae396084e02fe269a1d418a94b556094f5 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -1421,8 +1421,7 @@ void LCodeGen::DoModByConstI(LModByConstI* instr) { |
// Check for negative zero. |
HMod* hmod = instr->hydrogen(); |
- if (hmod->CheckFlag(HValue::kBailoutOnMinusZero) && |
- hmod->left()->CanBeNegative()) { |
+ if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { |
Label remainder_not_zero; |
__ j(not_zero, &remainder_not_zero, Label::kNear); |
__ cmp(dividend, Immediate(0)); |
@@ -1434,8 +1433,6 @@ void LCodeGen::DoModByConstI(LModByConstI* instr) { |
void LCodeGen::DoModI(LModI* instr) { |
HMod* hmod = instr->hydrogen(); |
- HValue* left = hmod->left(); |
- HValue* right = hmod->right(); |
Register left_reg = ToRegister(instr->left()); |
ASSERT(left_reg.is(eax)); |
@@ -1448,14 +1445,14 @@ void LCodeGen::DoModI(LModI* instr) { |
Label done; |
// Check for x % 0, idiv would signal a divide error. We have to |
// deopt in this case because we can't return a NaN. |
- if (right->CanBeZero()) { |
+ if (hmod->CheckFlag(HValue::kCanBeDivByZero)) { |
__ test(right_reg, Operand(right_reg)); |
DeoptimizeIf(zero, instr->environment()); |
} |
// Check for kMinInt % -1, idiv would signal a divide error. We |
// have to deopt if we care about -0, because we can't return that. |
- if (left->RangeCanInclude(kMinInt) && right->RangeCanInclude(-1)) { |
+ if (hmod->CheckFlag(HValue::kCanOverflow)) { |
Label no_overflow_possible; |
__ cmp(left_reg, kMinInt); |
__ j(not_equal, &no_overflow_possible, Label::kNear); |
@@ -1474,9 +1471,7 @@ void LCodeGen::DoModI(LModI* instr) { |
__ cdq(); |
// If we care about -0, test if the dividend is <0 and the result is 0. |
- if (left->CanBeNegative() && |
- hmod->CanBeZero() && |
- hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { |
+ if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { |
Label positive_left; |
__ test(left_reg, Operand(left_reg)); |
__ j(not_sign, &positive_left, Label::kNear); |
@@ -1500,14 +1495,12 @@ void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) { |
// Check for (0 / -x) that will produce negative zero. |
HDiv* hdiv = instr->hydrogen(); |
- if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && |
- hdiv->left()->RangeCanInclude(0) && divisor < 0) { |
+ if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
__ test(dividend, dividend); |
DeoptimizeIf(zero, instr->environment()); |
} |
// Check for (kMinInt / -1). |
- if (hdiv->CheckFlag(HValue::kCanOverflow) && |
- hdiv->left()->RangeCanInclude(kMinInt) && divisor == -1) { |
+ if (hdiv->CheckFlag(HValue::kCanOverflow) && divisor == -1) { |
__ cmp(dividend, kMinInt); |
DeoptimizeIf(zero, instr->environment()); |
} |
@@ -1543,8 +1536,7 @@ void LCodeGen::DoDivByConstI(LDivByConstI* instr) { |
// Check for (0 / -x) that will produce negative zero. |
HDiv* hdiv = instr->hydrogen(); |
- if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && |
- hdiv->left()->RangeCanInclude(0) && divisor < 0) { |
+ if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
__ test(dividend, dividend); |
DeoptimizeIf(zero, instr->environment()); |
} |
@@ -1565,6 +1557,7 @@ void LCodeGen::DoDivByConstI(LDivByConstI* instr) { |
void LCodeGen::DoDivI(LDivI* instr) { |
+ HBinaryOperation* hdiv = instr->hydrogen(); |
Register dividend = ToRegister(instr->left()); |
Register divisor = ToRegister(instr->right()); |
Register remainder = ToRegister(instr->temp()); |
@@ -1576,7 +1569,6 @@ void LCodeGen::DoDivI(LDivI* instr) { |
ASSERT(!divisor.is(edx)); |
// Check for x / 0. |
- HBinaryOperation* hdiv = instr->hydrogen(); |
if (hdiv->CheckFlag(HValue::kCanBeDivByZero)) { |
__ test(divisor, divisor); |
DeoptimizeIf(zero, instr->environment()); |
@@ -1606,7 +1598,7 @@ void LCodeGen::DoDivI(LDivI* instr) { |
__ cdq(); |
__ idiv(divisor); |
- if (instr->is_flooring()) { |
+ if (hdiv->IsMathFloorOfDiv()) { |
Label done; |
__ test(remainder, remainder); |
__ j(zero, &done, Label::kNear); |
@@ -1614,8 +1606,7 @@ void LCodeGen::DoDivI(LDivI* instr) { |
__ sar(remainder, 31); |
__ add(result, remainder); |
__ bind(&done); |
- } else if (!instr->hydrogen()->CheckFlag( |
- HInstruction::kAllUsesTruncatingToInt32)) { |
+ } else if (!hdiv->CheckFlag(HValue::kAllUsesTruncatingToInt32)) { |
// Deoptimize if remainder is not 0. |
__ test(remainder, remainder); |
DeoptimizeIf(not_zero, instr->environment()); |
@@ -1672,8 +1663,7 @@ void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { |
// Check for (0 / -x) that will produce negative zero. |
HMathFloorOfDiv* hdiv = instr->hydrogen(); |
- if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && |
- hdiv->left()->RangeCanInclude(0) && divisor < 0) { |
+ if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
__ test(dividend, dividend); |
DeoptimizeIf(zero, instr->environment()); |
} |