| Index: src/ia32/lithium-codegen-ia32.cc
|
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
|
| index 4318f31689916634f23032167ece94f30d05f8be..32bf92991ae8d7e26fbeaeeda56889e9fd6e95d6 100644
|
| --- a/src/ia32/lithium-codegen-ia32.cc
|
| +++ b/src/ia32/lithium-codegen-ia32.cc
|
| @@ -1906,12 +1906,21 @@ void LCodeGen::DoThrow(LThrow* instr) {
|
| void LCodeGen::DoAddI(LAddI* instr) {
|
| LOperand* left = instr->left();
|
| LOperand* right = instr->right();
|
| - ASSERT(left->Equals(instr->result()));
|
|
|
| - if (right->IsConstantOperand()) {
|
| - __ add(ToOperand(left), ToInteger32Immediate(right));
|
| + if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) {
|
| + if (right->IsConstantOperand()) {
|
| + int32_t offset = ToInteger32(LConstantOperand::cast(right));
|
| + __ lea(ToRegister(instr->result()), MemOperand(ToRegister(left), offset));
|
| + } else {
|
| + Operand address(ToRegister(left), ToRegister(right), times_1, 0);
|
| + __ lea(ToRegister(instr->result()), address);
|
| + }
|
| } else {
|
| - __ add(ToRegister(left), ToOperand(right));
|
| + if (right->IsConstantOperand()) {
|
| + __ add(ToOperand(left), ToInteger32Immediate(right));
|
| + } else {
|
| + __ add(ToRegister(left), ToOperand(right));
|
| + }
|
| }
|
|
|
| if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
|
|
|