| Index: src/a64/lithium-a64.cc
|
| diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc
|
| index cf89c09f5b2515d2dbc0b6cabe667b10245eb9ea..d2025fcb9a2ffb3d628a05b4f4c9a1a20ea3c0cb 100644
|
| --- a/src/a64/lithium-a64.cc
|
| +++ b/src/a64/lithium-a64.cc
|
| @@ -1369,7 +1369,7 @@ LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
|
| - ASSERT(instr->representation().IsInteger32());
|
| + ASSERT(instr->representation().IsSmiOrInteger32());
|
| ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| LOperand* dividend = UseRegister(instr->left());
|
| @@ -1387,25 +1387,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();
|
| - bool truncating = instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32);
|
| - LOperand* temp = truncating ? NULL : TempRegister();
|
| - LInstruction* result =
|
| - DefineAsRegister(new(zone()) LDivByConstI(dividend, divisor, temp));
|
| - bool can_deopt =
|
| - divisor == 0 ||
|
| - (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
|
| - instr->left()->RangeCanInclude(0) && divisor < 0) ||
|
| - !truncating;
|
| - return can_deopt ? AssignEnvironment(result) : result;
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) {
|
| ASSERT(instr->representation().IsSmiOrInteger32());
|
| ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| @@ -1421,13 +1402,10 @@ LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) {
|
|
|
| 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);
|
| - }
|
| + // TODO(all): Add Smi support to DoDivI and turn this into a ternary.
|
| + if (instr->RightIsPowerOf2()) return DoDivByPowerOf2I(instr);
|
| + if (instr->representation().IsInteger32()) return DoDivI(instr);
|
| + return DoArithmeticT(Token::DIV, instr);
|
| } else if (instr->representation().IsDouble()) {
|
| return DoArithmeticD(Token::DIV, instr);
|
| } else {
|
| @@ -1736,9 +1714,6 @@ LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
|
| - ASSERT(instr->representation().IsInteger32());
|
| - ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| - ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| LOperand* dividend = UseRegisterAtStart(instr->left());
|
| int32_t divisor = instr->right()->GetInteger32Constant();
|
| LInstruction* result =
|
| @@ -1750,22 +1725,6 @@ 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());
|
| - int32_t divisor = instr->right()->GetInteger32Constant();
|
| - LInstruction* result =
|
| - DefineAsRegister(new(zone()) LFlooringDivByConstI(dividend, divisor));
|
| - bool can_deopt =
|
| - divisor == 0 ||
|
| - (instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
|
| - instr->left()->RangeCanInclude(0) && divisor < 0);
|
| - return can_deopt ? AssignEnvironment(result) : result;
|
| -}
|
| -
|
| -
|
| LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) {
|
| LOperand* dividend = UseRegister(instr->left());
|
| LOperand* divisor = UseRegister(instr->right());
|
| @@ -1780,7 +1739,8 @@ LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
|
| if (instr->RightIsPowerOf2()) {
|
| return DoFlooringDivByPowerOf2I(instr);
|
| } else if (instr->right()->IsConstant()) {
|
| - return DoFlooringDivByConstI(instr);
|
| + // TODO(svenpanne) Do something more efficient in this case.
|
| + return DoFlooringDivI(instr);
|
| } else {
|
| return DoFlooringDivI(instr);
|
| }
|
| @@ -1807,7 +1767,7 @@ LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
|
| - ASSERT(instr->representation().IsInteger32());
|
| + ASSERT(instr->representation().IsSmiOrInteger32());
|
| ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| LOperand* dividend = UseRegisterAtStart(instr->left());
|
| @@ -1821,23 +1781,6 @@ LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoModByConstI(HMod* 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* temp = TempRegister();
|
| - LInstruction* result =
|
| - DefineAsRegister(new(zone()) LModByConstI(dividend, divisor, temp));
|
| - 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()));
|
| @@ -1855,13 +1798,10 @@ 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);
|
| - }
|
| + // TODO(all): Add Smi support to DoDivI and turn this into a ternary.
|
| + if (instr->RightIsPowerOf2()) return DoModByPowerOf2I(instr);
|
| + if (instr->representation().IsInteger32()) return DoModI(instr);
|
| + return DoArithmeticT(Token::MOD, instr);
|
| } else if (instr->representation().IsDouble()) {
|
| return DoArithmeticD(Token::MOD, instr);
|
| } else {
|
|
|