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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 // and addressing mode just happens to work out. The "addl"/"subl" forms | 747 // and addressing mode just happens to work out. The "addl"/"subl" forms |
748 // in these cases are faster based on measurements. | 748 // in these cases are faster based on measurements. |
749 if (i.InputRegister(0).is(i.OutputRegister())) { | 749 if (i.InputRegister(0).is(i.OutputRegister())) { |
750 if (mode == kMode_MRI) { | 750 if (mode == kMode_MRI) { |
751 int32_t constant_summand = i.InputInt32(1); | 751 int32_t constant_summand = i.InputInt32(1); |
752 if (constant_summand > 0) { | 752 if (constant_summand > 0) { |
753 __ addl(i.OutputRegister(), Immediate(constant_summand)); | 753 __ addl(i.OutputRegister(), Immediate(constant_summand)); |
754 } else if (constant_summand < 0) { | 754 } else if (constant_summand < 0) { |
755 __ subl(i.OutputRegister(), Immediate(-constant_summand)); | 755 __ subl(i.OutputRegister(), Immediate(-constant_summand)); |
756 } | 756 } |
757 } else if (mode == kMode_MR1 || mode == kMode_M2) { | 757 } else if (mode == kMode_MR1) { |
758 // Using "addl %r1, %r1" is generally faster than "shll %r1, 1" | 758 if (i.InputRegister(1).is(i.OutputRegister())) { |
759 __ addl(i.OutputRegister(), i.InputRegister(1)); | 759 __ shll(i.OutputRegister(), Immediate(1)); |
| 760 } else { |
| 761 __ leal(i.OutputRegister(), i.MemoryOperand()); |
| 762 } |
| 763 } else if (mode == kMode_M2) { |
| 764 __ shll(i.OutputRegister(), Immediate(1)); |
760 } else if (mode == kMode_M4) { | 765 } else if (mode == kMode_M4) { |
761 __ shll(i.OutputRegister(), Immediate(2)); | 766 __ shll(i.OutputRegister(), Immediate(2)); |
762 } else if (mode == kMode_M8) { | 767 } else if (mode == kMode_M8) { |
763 __ shll(i.OutputRegister(), Immediate(3)); | 768 __ shll(i.OutputRegister(), Immediate(3)); |
764 } else { | 769 } else { |
765 __ leal(i.OutputRegister(), i.MemoryOperand()); | 770 __ leal(i.OutputRegister(), i.MemoryOperand()); |
766 } | 771 } |
767 } else { | 772 } else { |
768 __ leal(i.OutputRegister(), i.MemoryOperand()); | 773 __ leal(i.OutputRegister(), i.MemoryOperand()); |
769 } | 774 } |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 } | 1255 } |
1251 | 1256 |
1252 | 1257 |
1253 void CodeGenerator::EnsureRelocSpaceForLazyDeopt(Handle<Code> code) {} | 1258 void CodeGenerator::EnsureRelocSpaceForLazyDeopt(Handle<Code> code) {} |
1254 | 1259 |
1255 #undef __ | 1260 #undef __ |
1256 | 1261 |
1257 } // namespace internal | 1262 } // namespace internal |
1258 } // namespace compiler | 1263 } // namespace compiler |
1259 } // namespace v8 | 1264 } // namespace v8 |
OLD | NEW |