| 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 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1774 Comment("Unreachable code."); | 1774 Comment("Unreachable code."); |
| 1775 __ int3(); | 1775 __ int3(); |
| 1776 } | 1776 } |
| 1777 } | 1777 } |
| 1778 | 1778 |
| 1779 | 1779 |
| 1780 void LCodeGen::DoAddI(LAddI* instr) { | 1780 void LCodeGen::DoAddI(LAddI* instr) { |
| 1781 LOperand* left = instr->left(); | 1781 LOperand* left = instr->left(); |
| 1782 LOperand* right = instr->right(); | 1782 LOperand* right = instr->right(); |
| 1783 | 1783 |
| 1784 Representation target_rep = instr->hydrogen()->representation(); |
| 1785 bool is_q = target_rep.IsSmi() || target_rep.IsExternal(); |
| 1786 |
| 1784 if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) { | 1787 if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) { |
| 1785 if (right->IsConstantOperand()) { | 1788 if (right->IsConstantOperand()) { |
| 1786 int32_t offset = ToInteger32(LConstantOperand::cast(right)); | 1789 int32_t offset = ToInteger32(LConstantOperand::cast(right)); |
| 1787 __ leal(ToRegister(instr->result()), | 1790 if (is_q) { |
| 1788 MemOperand(ToRegister(left), offset)); | 1791 __ lea(ToRegister(instr->result()), |
| 1792 MemOperand(ToRegister(left), offset)); |
| 1793 } else { |
| 1794 __ leal(ToRegister(instr->result()), |
| 1795 MemOperand(ToRegister(left), offset)); |
| 1796 } |
| 1789 } else { | 1797 } else { |
| 1790 Operand address(ToRegister(left), ToRegister(right), times_1, 0); | 1798 Operand address(ToRegister(left), ToRegister(right), times_1, 0); |
| 1791 if (instr->hydrogen()->representation().IsSmi()) { | 1799 if (is_q) { |
| 1792 __ lea(ToRegister(instr->result()), address); | 1800 __ lea(ToRegister(instr->result()), address); |
| 1793 } else { | 1801 } else { |
| 1794 __ leal(ToRegister(instr->result()), address); | 1802 __ leal(ToRegister(instr->result()), address); |
| 1795 } | 1803 } |
| 1796 } | 1804 } |
| 1797 } else { | 1805 } else { |
| 1798 if (right->IsConstantOperand()) { | 1806 if (right->IsConstantOperand()) { |
| 1799 __ addl(ToRegister(left), | 1807 if (is_q) { |
| 1800 Immediate(ToInteger32(LConstantOperand::cast(right)))); | 1808 __ addq(ToRegister(left), |
| 1809 Immediate(ToInteger32(LConstantOperand::cast(right)))); |
| 1810 } else { |
| 1811 __ addl(ToRegister(left), |
| 1812 Immediate(ToInteger32(LConstantOperand::cast(right)))); |
| 1813 } |
| 1801 } else if (right->IsRegister()) { | 1814 } else if (right->IsRegister()) { |
| 1802 if (instr->hydrogen_value()->representation().IsSmi()) { | 1815 if (is_q) { |
| 1803 __ addq(ToRegister(left), ToRegister(right)); | 1816 __ addq(ToRegister(left), ToRegister(right)); |
| 1804 } else { | 1817 } else { |
| 1805 __ addl(ToRegister(left), ToRegister(right)); | 1818 __ addl(ToRegister(left), ToRegister(right)); |
| 1806 } | 1819 } |
| 1807 } else { | 1820 } else { |
| 1808 if (instr->hydrogen_value()->representation().IsSmi()) { | 1821 if (is_q) { |
| 1809 __ addq(ToRegister(left), ToOperand(right)); | 1822 __ addq(ToRegister(left), ToOperand(right)); |
| 1810 } else { | 1823 } else { |
| 1811 __ addl(ToRegister(left), ToOperand(right)); | 1824 __ addl(ToRegister(left), ToOperand(right)); |
| 1812 } | 1825 } |
| 1813 } | 1826 } |
| 1814 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1827 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1815 DeoptimizeIf(overflow, instr->environment()); | 1828 DeoptimizeIf(overflow, instr->environment()); |
| 1816 } | 1829 } |
| 1817 } | 1830 } |
| 1818 } | 1831 } |
| (...skipping 3867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5686 FixedArray::kHeaderSize - kPointerSize)); | 5699 FixedArray::kHeaderSize - kPointerSize)); |
| 5687 __ bind(&done); | 5700 __ bind(&done); |
| 5688 } | 5701 } |
| 5689 | 5702 |
| 5690 | 5703 |
| 5691 #undef __ | 5704 #undef __ |
| 5692 | 5705 |
| 5693 } } // namespace v8::internal | 5706 } } // namespace v8::internal |
| 5694 | 5707 |
| 5695 #endif // V8_TARGET_ARCH_X64 | 5708 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |