OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 Comment("Unreachable code."); | 1776 Comment("Unreachable code."); |
1777 __ int3(); | 1777 __ int3(); |
1778 } | 1778 } |
1779 } | 1779 } |
1780 | 1780 |
1781 | 1781 |
1782 void LCodeGen::DoAddI(LAddI* instr) { | 1782 void LCodeGen::DoAddI(LAddI* instr) { |
1783 LOperand* left = instr->left(); | 1783 LOperand* left = instr->left(); |
1784 LOperand* right = instr->right(); | 1784 LOperand* right = instr->right(); |
1785 | 1785 |
| 1786 Representation target_rep = instr->hydrogen()->representation(); |
| 1787 bool is_q = target_rep.IsSmi() || target_rep.IsExternal(); |
| 1788 |
1786 if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) { | 1789 if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) { |
1787 if (right->IsConstantOperand()) { | 1790 if (right->IsConstantOperand()) { |
1788 int32_t offset = ToInteger32(LConstantOperand::cast(right)); | 1791 int32_t offset = ToInteger32(LConstantOperand::cast(right)); |
1789 __ leal(ToRegister(instr->result()), | 1792 if (is_q) { |
1790 MemOperand(ToRegister(left), offset)); | 1793 __ lea(ToRegister(instr->result()), |
| 1794 MemOperand(ToRegister(left), offset)); |
| 1795 } else { |
| 1796 __ leal(ToRegister(instr->result()), |
| 1797 MemOperand(ToRegister(left), offset)); |
| 1798 } |
1791 } else { | 1799 } else { |
1792 Operand address(ToRegister(left), ToRegister(right), times_1, 0); | 1800 Operand address(ToRegister(left), ToRegister(right), times_1, 0); |
1793 if (instr->hydrogen()->representation().IsSmi()) { | 1801 if (is_q) { |
1794 __ lea(ToRegister(instr->result()), address); | 1802 __ lea(ToRegister(instr->result()), address); |
1795 } else { | 1803 } else { |
1796 __ leal(ToRegister(instr->result()), address); | 1804 __ leal(ToRegister(instr->result()), address); |
1797 } | 1805 } |
1798 } | 1806 } |
1799 } else { | 1807 } else { |
1800 if (right->IsConstantOperand()) { | 1808 if (right->IsConstantOperand()) { |
1801 __ addl(ToRegister(left), | 1809 if (is_q) { |
1802 Immediate(ToInteger32(LConstantOperand::cast(right)))); | 1810 __ addq(ToRegister(left), |
| 1811 Immediate(ToInteger32(LConstantOperand::cast(right)))); |
| 1812 } else { |
| 1813 __ addl(ToRegister(left), |
| 1814 Immediate(ToInteger32(LConstantOperand::cast(right)))); |
| 1815 } |
1803 } else if (right->IsRegister()) { | 1816 } else if (right->IsRegister()) { |
1804 if (instr->hydrogen_value()->representation().IsSmi()) { | 1817 if (is_q) { |
1805 __ addq(ToRegister(left), ToRegister(right)); | 1818 __ addq(ToRegister(left), ToRegister(right)); |
1806 } else { | 1819 } else { |
1807 __ addl(ToRegister(left), ToRegister(right)); | 1820 __ addl(ToRegister(left), ToRegister(right)); |
1808 } | 1821 } |
1809 } else { | 1822 } else { |
1810 if (instr->hydrogen_value()->representation().IsSmi()) { | 1823 if (is_q) { |
1811 __ addq(ToRegister(left), ToOperand(right)); | 1824 __ addq(ToRegister(left), ToOperand(right)); |
1812 } else { | 1825 } else { |
1813 __ addl(ToRegister(left), ToOperand(right)); | 1826 __ addl(ToRegister(left), ToOperand(right)); |
1814 } | 1827 } |
1815 } | 1828 } |
1816 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1829 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
1817 DeoptimizeIf(overflow, instr->environment()); | 1830 DeoptimizeIf(overflow, instr->environment()); |
1818 } | 1831 } |
1819 } | 1832 } |
1820 } | 1833 } |
(...skipping 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5697 FixedArray::kHeaderSize - kPointerSize)); | 5710 FixedArray::kHeaderSize - kPointerSize)); |
5698 __ bind(&done); | 5711 __ bind(&done); |
5699 } | 5712 } |
5700 | 5713 |
5701 | 5714 |
5702 #undef __ | 5715 #undef __ |
5703 | 5716 |
5704 } } // namespace v8::internal | 5717 } } // namespace v8::internal |
5705 | 5718 |
5706 #endif // V8_TARGET_ARCH_X64 | 5719 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |