| Index: src/ia32/lithium-ia32.cc
|
| diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
|
| index 3153584553c250fb1d4e7f9f0732a99e610c547d..4ff765b87bb83cca9cd703fe3f6d60731c2c2621 100644
|
| --- a/src/ia32/lithium-ia32.cc
|
| +++ b/src/ia32/lithium-ia32.cc
|
| @@ -1340,26 +1340,6 @@ LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) {
|
| - ASSERT(instr->representation().IsInteger32());
|
| - ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| - ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| - LOperand* dividend = UseRegister(instr->left());
|
| - int32_t divisor = instr->right()->GetInteger32Constant();
|
| - LOperand* temp1 = FixedTemp(eax);
|
| - LOperand* temp2 = FixedTemp(edx);
|
| - LInstruction* result =
|
| - DefineFixed(
|
| - new(zone()) LDivByConstI(dividend, divisor, temp1, temp2), edx);
|
| - bool can_deopt =
|
| - divisor == 0 ||
|
| - (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
|
| - instr->left()->RangeCanInclude(0) && divisor < 0) ||
|
| - !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32);
|
| - return can_deopt ? AssignEnvironment(result) : result;
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) {
|
| ASSERT(instr->representation().IsSmiOrInteger32());
|
| ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| @@ -1367,21 +1347,14 @@ LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) {
|
| LOperand* dividend = UseFixed(instr->left(), eax);
|
| LOperand* divisor = UseRegister(instr->right());
|
| LOperand* temp = FixedTemp(edx);
|
| - LInstruction* result =
|
| - DefineFixed(new(zone()) LDivI(dividend, divisor, temp), eax);
|
| - return AssignEnvironment(result);
|
| + LDivI* result = new(zone()) LDivI(dividend, divisor, temp);
|
| + return AssignEnvironment(DefineFixed(result, eax));
|
| }
|
|
|
|
|
| LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
|
| if (instr->representation().IsSmiOrInteger32()) {
|
| - if (instr->RightIsPowerOf2()) {
|
| - return DoDivByPowerOf2I(instr);
|
| - } else if (instr->right()->IsConstant()) {
|
| - return DoDivByConstI(instr);
|
| - } else {
|
| - return DoDivI(instr);
|
| - }
|
| + return instr->RightIsPowerOf2() ? DoDivByPowerOf2I(instr) : DoDivI(instr);
|
| } else if (instr->representation().IsDouble()) {
|
| return DoArithmeticD(Token::DIV, instr);
|
| } else {
|
| @@ -1403,23 +1376,13 @@ LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) {
|
| - ASSERT(instr->representation().IsInteger32());
|
| - ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| - ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| - LOperand* dividend = UseRegister(instr->left());
|
| + LOperand* dividend = UseFixed(instr->left(), eax);
|
| int32_t divisor = instr->right()->GetInteger32Constant();
|
| - LOperand* temp1 = FixedTemp(eax);
|
| - LOperand* temp2 = FixedTemp(edx);
|
| + LOperand* temp = TempRegister();
|
| LInstruction* result =
|
| - DefineFixed(new(zone()) LFlooringDivByConstI(dividend,
|
| - divisor,
|
| - temp1,
|
| - temp2),
|
| - edx);
|
| - bool can_deopt =
|
| - divisor == 0 ||
|
| - (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
|
| - instr->left()->RangeCanInclude(0) && divisor < 0);
|
| + DefineFixed(
|
| + new(zone()) LFlooringDivByConstI(dividend, divisor, temp), edx);
|
| + bool can_deopt = divisor <= 0;
|
| return can_deopt ? AssignEnvironment(result) : result;
|
| }
|
|
|
| @@ -1450,25 +1413,6 @@ LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) {
|
| - ASSERT(instr->representation().IsSmiOrInteger32());
|
| - ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| - ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| - LOperand* dividend = UseRegister(instr->left());
|
| - int32_t divisor = instr->right()->GetInteger32Constant();
|
| - LOperand* temp1 = FixedTemp(eax);
|
| - LOperand* temp2 = FixedTemp(edx);
|
| - LInstruction* result =
|
| - DefineFixed(
|
| - new(zone()) LModByConstI(dividend, divisor, temp1, temp2), eax);
|
| - bool can_deopt =
|
| - divisor == 0 ||
|
| - (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
|
| - instr->left()->CanBeNegative());
|
| - return can_deopt ? AssignEnvironment(result) : result;
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoModI(HMod* instr) {
|
| ASSERT(instr->representation().IsSmiOrInteger32());
|
| ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| @@ -1491,13 +1435,7 @@ LInstruction* LChunkBuilder::DoModI(HMod* instr) {
|
|
|
| LInstruction* LChunkBuilder::DoMod(HMod* instr) {
|
| if (instr->representation().IsSmiOrInteger32()) {
|
| - if (instr->RightIsPowerOf2()) {
|
| - return DoModByPowerOf2I(instr);
|
| - } else if (instr->right()->IsConstant()) {
|
| - return DoModByConstI(instr);
|
| - } else {
|
| - return DoModI(instr);
|
| - }
|
| + return instr->RightIsPowerOf2() ? DoModByPowerOf2I(instr) : DoModI(instr);
|
| } else if (instr->representation().IsDouble()) {
|
| return DoArithmeticD(Token::MOD, instr);
|
| } else {
|
|
|