| Index: src/ia32/lithium-codegen-ia32.cc
|
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
|
| index 449ed3e917ee7a977858eb3c41e33a06eecb2426..bfed6d31568f5d3eb49b810ca5038c1c30ef98c5 100644
|
| --- a/src/ia32/lithium-codegen-ia32.cc
|
| +++ b/src/ia32/lithium-codegen-ia32.cc
|
| @@ -1906,16 +1906,24 @@ 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 (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
|
| - DeoptimizeIf(overflow, instr->environment());
|
| + if (right->IsConstantOperand()) {
|
| + __ add(ToOperand(left), ToInteger32Immediate(right));
|
| + } else {
|
| + __ add(ToRegister(left), ToOperand(right));
|
| + }
|
| + if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
|
| + DeoptimizeIf(overflow, instr->environment());
|
| + }
|
| }
|
| }
|
|
|
|
|