OLD | NEW |
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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 break; | 583 break; |
584 case kX64Movsd: | 584 case kX64Movsd: |
585 if (instr->HasOutput()) { | 585 if (instr->HasOutput()) { |
586 __ movsd(i.OutputDoubleRegister(), i.MemoryOperand()); | 586 __ movsd(i.OutputDoubleRegister(), i.MemoryOperand()); |
587 } else { | 587 } else { |
588 int index = 0; | 588 int index = 0; |
589 Operand operand = i.MemoryOperand(&index); | 589 Operand operand = i.MemoryOperand(&index); |
590 __ movsd(operand, i.InputDoubleRegister(index)); | 590 __ movsd(operand, i.InputDoubleRegister(index)); |
591 } | 591 } |
592 break; | 592 break; |
593 case kX64Lea32: | 593 case kX64Lea32: { |
594 __ leal(i.OutputRegister(), i.MemoryOperand()); | 594 AddressingMode mode = AddressingModeField::decode(instr->opcode()); |
| 595 // Shorten "leal" to "addl" or "subl" if the register allocation just |
| 596 // happens to work out for operations with immediate operands where the |
| 597 // non-constant input register is the same as output register. The |
| 598 // "addl"/"subl" forms in these cases are faster based on empirical |
| 599 // measurements. |
| 600 if (mode == kMode_MRI && i.InputRegister(0).is(i.OutputRegister())) { |
| 601 int32_t constant_summand = i.InputInt32(1); |
| 602 if (constant_summand > 0) { |
| 603 __ addl(i.OutputRegister(), Immediate(constant_summand)); |
| 604 } else if (constant_summand < 0) { |
| 605 __ subl(i.OutputRegister(), Immediate(-constant_summand)); |
| 606 } |
| 607 } else { |
| 608 __ leal(i.OutputRegister(), i.MemoryOperand()); |
| 609 } |
595 __ AssertZeroExtended(i.OutputRegister()); | 610 __ AssertZeroExtended(i.OutputRegister()); |
596 break; | 611 break; |
| 612 } |
597 case kX64Lea: | 613 case kX64Lea: |
598 __ leaq(i.OutputRegister(), i.MemoryOperand()); | 614 __ leaq(i.OutputRegister(), i.MemoryOperand()); |
599 break; | 615 break; |
600 case kX64Dec32: | 616 case kX64Dec32: |
601 __ decl(i.OutputRegister()); | 617 __ decl(i.OutputRegister()); |
602 break; | 618 break; |
603 case kX64Inc32: | 619 case kX64Inc32: |
604 __ incl(i.OutputRegister()); | 620 __ incl(i.OutputRegister()); |
605 break; | 621 break; |
606 case kX64Push: | 622 case kX64Push: |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 } | 1051 } |
1036 } | 1052 } |
1037 MarkLazyDeoptSite(); | 1053 MarkLazyDeoptSite(); |
1038 } | 1054 } |
1039 | 1055 |
1040 #undef __ | 1056 #undef __ |
1041 | 1057 |
1042 } // namespace internal | 1058 } // namespace internal |
1043 } // namespace compiler | 1059 } // namespace compiler |
1044 } // namespace v8 | 1060 } // namespace v8 |
OLD | NEW |