Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: src/compiler/ia32/code-generator-ia32.cc

Issue 747283005: [turbofan]: Port lea changes to ia32 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: For Dan Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/ia32/instruction-selector-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 break; 598 break;
599 case kIA32Movss: 599 case kIA32Movss:
600 if (instr->HasOutput()) { 600 if (instr->HasOutput()) {
601 __ movss(i.OutputDoubleRegister(), i.MemoryOperand()); 601 __ movss(i.OutputDoubleRegister(), i.MemoryOperand());
602 } else { 602 } else {
603 int index = 0; 603 int index = 0;
604 Operand operand = i.MemoryOperand(&index); 604 Operand operand = i.MemoryOperand(&index);
605 __ movss(operand, i.InputDoubleRegister(index)); 605 __ movss(operand, i.InputDoubleRegister(index));
606 } 606 }
607 break; 607 break;
608 case kIA32Lea: 608 case kIA32Lea: {
609 __ lea(i.OutputRegister(), i.MemoryOperand()); 609 AddressingMode mode = AddressingModeField::decode(instr->opcode());
610 // Shorten "leal" to "addl", "subl" or "shll" if the register allocation
611 // and addressing mode just happens to work out. The "addl"/"subl" forms
612 // in these cases are faster based on measurements.
613 if (mode == kMode_MI) {
614 __ Move(i.OutputRegister(), Immediate(i.InputInt32(0)));
615 } else if (i.InputRegister(0).is(i.OutputRegister())) {
616 if (mode == kMode_MRI) {
617 int32_t constant_summand = i.InputInt32(1);
618 if (constant_summand > 0) {
619 __ add(i.OutputRegister(), Immediate(constant_summand));
620 } else if (constant_summand < 0) {
621 __ sub(i.OutputRegister(), Immediate(-constant_summand));
622 }
623 } else if (mode == kMode_MR1) {
624 if (i.InputRegister(1).is(i.OutputRegister())) {
625 __ shl(i.OutputRegister(), 1);
626 } else {
627 __ lea(i.OutputRegister(), i.MemoryOperand());
628 }
629 } else if (mode == kMode_M2) {
630 __ shl(i.OutputRegister(), 1);
631 } else if (mode == kMode_M4) {
632 __ shl(i.OutputRegister(), 2);
633 } else if (mode == kMode_M8) {
634 __ shl(i.OutputRegister(), 3);
635 } else {
636 __ lea(i.OutputRegister(), i.MemoryOperand());
637 }
638 } else {
639 __ lea(i.OutputRegister(), i.MemoryOperand());
640 }
610 break; 641 break;
642 }
611 case kIA32Push: 643 case kIA32Push:
612 if (HasImmediateInput(instr, 0)) { 644 if (HasImmediateInput(instr, 0)) {
613 __ push(i.InputImmediate(0)); 645 __ push(i.InputImmediate(0));
614 } else { 646 } else {
615 __ push(i.InputOperand(0)); 647 __ push(i.InputOperand(0));
616 } 648 }
617 break; 649 break;
618 case kIA32StoreWriteBarrier: { 650 case kIA32StoreWriteBarrier: {
619 Register object = i.InputRegister(0); 651 Register object = i.InputRegister(0);
620 Register index = i.InputRegister(1); 652 Register index = i.InputRegister(1);
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 } 1245 }
1214 } 1246 }
1215 MarkLazyDeoptSite(); 1247 MarkLazyDeoptSite();
1216 } 1248 }
1217 1249
1218 #undef __ 1250 #undef __
1219 1251
1220 } // namespace compiler 1252 } // namespace compiler
1221 } // namespace internal 1253 } // namespace internal
1222 } // namespace v8 1254 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ia32/instruction-selector-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698