| Index: src/ia32/lithium-ia32.cc
|
| diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
|
| index 0ade55f003cb8b9fb2b268fe6813f18b23135e9f..80fd71d6020a88827a9aaf06920953f70fa18144 100644
|
| --- a/src/ia32/lithium-ia32.cc
|
| +++ b/src/ia32/lithium-ia32.cc
|
| @@ -1366,13 +1366,23 @@ LInstruction* LChunkBuilder::DoMod(HMod* instr) {
|
| if (instr->representation().IsInteger32()) {
|
| ASSERT(instr->left()->representation().IsInteger32());
|
| ASSERT(instr->right()->representation().IsInteger32());
|
| - // The temporary operand is necessary to ensure that right is not allocated
|
| - // into edx.
|
| - LOperand* temp = FixedTemp(edx);
|
| - LOperand* value = UseFixed(instr->left(), eax);
|
| - LOperand* divisor = UseRegister(instr->right());
|
| - LModI* mod = new LModI(value, divisor, temp);
|
| - LInstruction* result = DefineFixed(mod, edx);
|
| +
|
| + LInstruction* result;
|
| + if (instr->HasPowerOf2Divisor()) {
|
| + ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
|
| + LOperand* value = UseRegisterAtStart(instr->left());
|
| + LModI* mod = new LModI(value, UseOrConstant(instr->right()), NULL);
|
| + result = DefineSameAsFirst(mod);
|
| + } else {
|
| + // The temporary operand is necessary to ensure that right is
|
| + // not allocated into edx.
|
| + LOperand* temp = FixedTemp(edx);
|
| + LOperand* value = UseFixed(instr->left(), eax);
|
| + LOperand* divisor = UseRegister(instr->right());
|
| + LModI* mod = new LModI(value, divisor, temp);
|
| + result = DefineFixed(mod, edx);
|
| + }
|
| +
|
| return (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
|
| instr->CheckFlag(HValue::kCanBeDivByZero))
|
| ? AssignEnvironment(result)
|
|
|