[turbofan] Fix Corrections tankage on x64.
authordanno <danno@chromium.org>
Fri, 5 Dec 2014 13:05:38 +0000 (05:05 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 5 Dec 2014 13:05:46 +0000 (13:05 +0000)
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/771073003

Cr-Commit-Position: refs/heads/master@{#25683}

src/compiler/x64/code-generator-x64.cc

index f2679b0391b01f25dca742d011352471dbee4c7a..ec4d5b6c9f97463cf7bca283164c94f96cdd0b0c 100644 (file)
@@ -754,9 +754,14 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
           } else if (constant_summand < 0) {
             __ subl(i.OutputRegister(), Immediate(-constant_summand));
           }
-        } else if (mode == kMode_MR1 || mode == kMode_M2) {
-          // Using "addl %r1, %r1" is generally faster than "shll %r1, 1"
-          __ addl(i.OutputRegister(), i.InputRegister(1));
+        } else if (mode == kMode_MR1) {
+          if (i.InputRegister(1).is(i.OutputRegister())) {
+            __ shll(i.OutputRegister(), Immediate(1));
+          } else {
+            __ leal(i.OutputRegister(), i.MemoryOperand());
+          }
+        } else if (mode == kMode_M2) {
+          __ shll(i.OutputRegister(), Immediate(1));
         } else if (mode == kMode_M4) {
           __ shll(i.OutputRegister(), Immediate(2));
         } else if (mode == kMode_M8) {