| Index: src/a64/lithium-a64.cc
|
| diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc
|
| index 11cf0d138b1f4127cde22a41eb3bd941ef508347..414dab31dc749f1b5e0041525ee341bfc52d8722 100644
|
| --- a/src/a64/lithium-a64.cc
|
| +++ b/src/a64/lithium-a64.cc
|
| @@ -1761,16 +1761,37 @@ LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoMod(HMod* instr) {
|
| - if (instr->representation().IsInteger32()) {
|
| - ASSERT(instr->left()->representation().IsInteger32());
|
| - ASSERT(instr->right()->representation().IsInteger32());
|
| +LInstruction* LChunkBuilder::DoMod(HMod* hmod) {
|
| + HValue* hleft = hmod->left();
|
| + HValue* hright = hmod->right();
|
| +
|
| + if (hmod->representation().IsInteger32()) {
|
| + ASSERT(hleft->representation().IsInteger32());
|
| + ASSERT(hleft->representation().IsInteger32());
|
| + LOperand* left_op;
|
| + LOperand* right_op;
|
| +
|
| + if (hmod->HasPowerOf2Divisor()) {
|
| + left_op = UseRegisterAtStart(hleft);
|
| + right_op = UseConstant(hright);
|
| + } else {
|
| + right_op = UseRegister(hright);
|
| + left_op = UseRegister(hleft);
|
| + }
|
| +
|
| + LModI* lmod = new(zone()) LModI(left_op, right_op);
|
| +
|
| + if (hmod->right()->CanBeZero() ||
|
| + (hmod->CheckFlag(HValue::kBailoutOnMinusZero) &&
|
| + hmod->left()->CanBeNegative() && hmod->CanBeZero())) {
|
| + AssignEnvironment(lmod);
|
| + }
|
| + return DefineAsRegister(lmod);
|
|
|
| - UNIMPLEMENTED_INSTRUCTION();
|
| - } else if (instr->representation().IsSmiOrTagged()) {
|
| - UNIMPLEMENTED_INSTRUCTION();
|
| + } else if (hmod->representation().IsSmiOrTagged()) {
|
| + return DoArithmeticT(Token::MOD, hmod);
|
| } else {
|
| - return DoArithmeticD(Token::MOD, instr);
|
| + return DoArithmeticD(Token::MOD, hmod);
|
| }
|
| }
|
|
|
|
|