| Index: src/x64/lithium-x64.cc
|
| diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
|
| index b174a0e24a62c0eb98eb887673f821a30ef9496f..d1c77311ecf9da440af7748ffbf7567f6e5c78c2 100644
|
| --- a/src/x64/lithium-x64.cc
|
| +++ b/src/x64/lithium-x64.cc
|
| @@ -1532,14 +1532,19 @@ LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
|
| ASSERT(instr->right()->representation().Equals(instr->representation()));
|
| LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
|
| HValue* right_candidate = instr->BetterRightOperand();
|
| - LOperand* right = use_lea
|
| - ? UseRegisterOrConstantAtStart(right_candidate)
|
| - : UseOrConstantAtStart(right_candidate);
|
| + LOperand* right;
|
| + if (instr->representation().IsSmi()) {
|
| + // We cannot add a tagged immediate to a tagged value,
|
| + // so we request it in a register.
|
| + right = UseRegisterAtStart(right_candidate);
|
| + } else {
|
| + right = use_lea ? UseRegisterOrConstantAtStart(right_candidate)
|
| + : UseOrConstantAtStart(right_candidate);
|
| + }
|
| LAddI* add = new(zone()) LAddI(left, right);
|
| bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
|
| - LInstruction* result = use_lea
|
| - ? DefineAsRegister(add)
|
| - : DefineSameAsFirst(add);
|
| + LInstruction* result = use_lea ? DefineAsRegister(add)
|
| + : DefineSameAsFirst(add);
|
| if (can_overflow) {
|
| result = AssignEnvironment(result);
|
| }
|
|
|