| Index: src/a64/lithium-a64.cc
|
| diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc
|
| index e32bb2dc4ad66bd2dc6c47bc7092dab9817dce5f..62e309f2e3c9c6e7d5079b6f4b812ed5249fbba4 100644
|
| --- a/src/a64/lithium-a64.cc
|
| +++ b/src/a64/lithium-a64.cc
|
| @@ -1377,22 +1377,28 @@ LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
|
| - if (instr->representation().IsInteger32()) {
|
| - // TODO(all): Update this case to support smi inputs.
|
| + if (instr->representation().IsSmiOrInteger32()) {
|
| ASSERT(instr->left()->representation().Equals(instr->representation()));
|
| ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| +
|
| + LOperand* dividend = UseRegister(instr->left());
|
| +
|
| if (instr->RightIsPowerOf2()) {
|
| ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
|
| - LOperand* value = UseRegisterAtStart(instr->left());
|
| - LDivI* div = new(zone()) LDivI(value, UseConstant(instr->right()), NULL);
|
| + LOperand* divisor = UseConstant(instr->right());
|
| + LDivConstI* div = new(zone()) LDivConstI(dividend, divisor);
|
| + return AssignEnvironment(DefineAsRegister(div));
|
| + } else {
|
| + LOperand* divisor = UseRegister(instr->right());
|
| + LOperand* temp1 =
|
| + instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)
|
| + ? NULL : TempRegister();
|
| + LOperand* temp2 = instr->representation().IsSmi() ? TempRegister() : NULL;
|
| + LOperand* temp3 = instr->representation().IsSmi() ? TempRegister() : NULL;
|
| +
|
| + LDivI* div = new(zone()) LDivI(dividend, divisor, temp1, temp2, temp3);
|
| return AssignEnvironment(DefineAsRegister(div));
|
| }
|
| - LOperand* dividend = UseRegister(instr->left());
|
| - LOperand* divisor = UseRegister(instr->right());
|
| - LOperand* temp = instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)
|
| - ? NULL : TempRegister();
|
| - LDivI* div = new(zone()) LDivI(dividend, divisor, temp);
|
| - return AssignEnvironment(DefineAsRegister(div));
|
| } else if (instr->representation().IsDouble()) {
|
| return DoArithmeticD(Token::DIV, instr);
|
| } else {
|
|
|