| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( | 1766 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( |
| 1767 HLoadExternalArrayPointer* instr) { | 1767 HLoadExternalArrayPointer* instr) { |
| 1768 LOperand* input = UseRegisterAtStart(instr->value()); | 1768 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1769 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 1769 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 1770 } | 1770 } |
| 1771 | 1771 |
| 1772 | 1772 |
| 1773 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( | 1773 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
| 1774 HLoadKeyedFastElement* instr) { | 1774 HLoadKeyedFastElement* instr) { |
| 1775 ASSERT(instr->representation().IsTagged()); | 1775 ASSERT(instr->representation().IsTagged()); |
| 1776 ASSERT(instr->key()->representation().IsInteger32()); | 1776 ASSERT(instr->key()->representation().IsInteger32() || |
| 1777 instr->key()->representation().IsTagged()); |
| 1777 LOperand* obj = UseRegisterAtStart(instr->object()); | 1778 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1778 LOperand* key = UseRegisterAtStart(instr->key()); | 1779 LOperand* key = UseRegisterAtStart(instr->key()); |
| 1779 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key); | 1780 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key); |
| 1780 if (instr->RequiresHoleCheck()) AssignEnvironment(result); | 1781 if (instr->RequiresHoleCheck()) AssignEnvironment(result); |
| 1781 return DefineAsRegister(result); | 1782 return DefineAsRegister(result); |
| 1782 } | 1783 } |
| 1783 | 1784 |
| 1784 | 1785 |
| 1785 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( | 1786 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( |
| 1786 HLoadKeyedFastDoubleElement* instr) { | 1787 HLoadKeyedFastDoubleElement* instr) { |
| 1787 ASSERT(instr->representation().IsDouble()); | 1788 ASSERT(instr->representation().IsDouble()); |
| 1788 ASSERT(instr->key()->representation().IsInteger32()); | 1789 ASSERT(instr->key()->representation().IsInteger32() || |
| 1790 instr->key()->representation().IsTagged()); |
| 1789 LOperand* elements = UseTempRegister(instr->elements()); | 1791 LOperand* elements = UseTempRegister(instr->elements()); |
| 1790 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1792 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1791 LLoadKeyedFastDoubleElement* result = | 1793 LLoadKeyedFastDoubleElement* result = |
| 1792 new(zone()) LLoadKeyedFastDoubleElement(elements, key); | 1794 new(zone()) LLoadKeyedFastDoubleElement(elements, key); |
| 1793 return AssignEnvironment(DefineAsRegister(result)); | 1795 return AssignEnvironment(DefineAsRegister(result)); |
| 1794 } | 1796 } |
| 1795 | 1797 |
| 1796 | 1798 |
| 1797 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1799 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
| 1798 HLoadKeyedSpecializedArrayElement* instr) { | 1800 HLoadKeyedSpecializedArrayElement* instr) { |
| 1799 ElementsKind elements_kind = instr->elements_kind(); | 1801 ElementsKind elements_kind = instr->elements_kind(); |
| 1800 Representation representation(instr->representation()); | 1802 Representation representation(instr->representation()); |
| 1801 ASSERT( | 1803 ASSERT( |
| 1802 (representation.IsInteger32() && | 1804 (representation.IsInteger32() && |
| 1803 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1805 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1804 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1806 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1805 (representation.IsDouble() && | 1807 (representation.IsDouble() && |
| 1806 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1808 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1807 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1809 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1808 ASSERT(instr->key()->representation().IsInteger32()); | 1810 ASSERT(instr->key()->representation().IsInteger32() || |
| 1811 instr->key()->representation().IsTagged()); |
| 1809 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1812 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1810 LOperand* key = UseRegisterOrConstant(instr->key()); | 1813 LOperand* key = UseRegisterOrConstant(instr->key()); |
| 1811 LLoadKeyedSpecializedArrayElement* result = | 1814 LLoadKeyedSpecializedArrayElement* result = |
| 1812 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, key); | 1815 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, key); |
| 1813 LInstruction* load_instr = DefineAsRegister(result); | 1816 LInstruction* load_instr = DefineAsRegister(result); |
| 1814 // An unsigned int array load might overflow and cause a deopt, make sure it | 1817 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1815 // has an environment. | 1818 // has an environment. |
| 1816 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ? | 1819 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ? |
| 1817 AssignEnvironment(load_instr) : load_instr; | 1820 AssignEnvironment(load_instr) : load_instr; |
| 1818 } | 1821 } |
| 1819 | 1822 |
| 1820 | 1823 |
| 1821 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1824 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1822 LOperand* object = UseFixed(instr->object(), a1); | 1825 LOperand* object = UseFixed(instr->object(), a1); |
| 1823 LOperand* key = UseFixed(instr->key(), a0); | 1826 LOperand* key = UseFixed(instr->key(), a0); |
| 1824 | 1827 |
| 1825 LInstruction* result = | 1828 LInstruction* result = |
| 1826 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0); | 1829 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0); |
| 1827 return MarkAsCall(result, instr); | 1830 return MarkAsCall(result, instr); |
| 1828 } | 1831 } |
| 1829 | 1832 |
| 1830 | 1833 |
| 1831 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( | 1834 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( |
| 1832 HStoreKeyedFastElement* instr) { | 1835 HStoreKeyedFastElement* instr) { |
| 1833 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1836 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 1834 ASSERT(instr->value()->representation().IsTagged()); | 1837 ASSERT(instr->value()->representation().IsTagged()); |
| 1835 ASSERT(instr->object()->representation().IsTagged()); | 1838 ASSERT(instr->object()->representation().IsTagged()); |
| 1836 ASSERT(instr->key()->representation().IsInteger32()); | 1839 ASSERT(instr->key()->representation().IsInteger32() || |
| 1840 instr->key()->representation().IsTagged()); |
| 1837 | 1841 |
| 1838 LOperand* obj = UseTempRegister(instr->object()); | 1842 LOperand* obj = UseTempRegister(instr->object()); |
| 1839 LOperand* val = needs_write_barrier | 1843 LOperand* val = needs_write_barrier |
| 1840 ? UseTempRegister(instr->value()) | 1844 ? UseTempRegister(instr->value()) |
| 1841 : UseRegisterAtStart(instr->value()); | 1845 : UseRegisterAtStart(instr->value()); |
| 1842 LOperand* key = needs_write_barrier | 1846 LOperand* key = needs_write_barrier |
| 1843 ? UseTempRegister(instr->key()) | 1847 ? UseTempRegister(instr->key()) |
| 1844 : UseRegisterOrConstantAtStart(instr->key()); | 1848 : UseRegisterOrConstantAtStart(instr->key()); |
| 1845 return new(zone()) LStoreKeyedFastElement(obj, key, val); | 1849 return new(zone()) LStoreKeyedFastElement(obj, key, val); |
| 1846 } | 1850 } |
| 1847 | 1851 |
| 1848 | 1852 |
| 1849 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement( | 1853 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement( |
| 1850 HStoreKeyedFastDoubleElement* instr) { | 1854 HStoreKeyedFastDoubleElement* instr) { |
| 1851 ASSERT(instr->value()->representation().IsDouble()); | 1855 ASSERT(instr->value()->representation().IsDouble()); |
| 1852 ASSERT(instr->elements()->representation().IsTagged()); | 1856 ASSERT(instr->elements()->representation().IsTagged()); |
| 1853 ASSERT(instr->key()->representation().IsInteger32()); | 1857 ASSERT(instr->key()->representation().IsInteger32() || |
| 1858 instr->key()->representation().IsTagged()); |
| 1854 | 1859 |
| 1855 LOperand* elements = UseRegisterAtStart(instr->elements()); | 1860 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1856 LOperand* val = UseTempRegister(instr->value()); | 1861 LOperand* val = UseTempRegister(instr->value()); |
| 1857 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1862 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1858 | 1863 |
| 1859 return new(zone()) LStoreKeyedFastDoubleElement(elements, key, val); | 1864 return new(zone()) LStoreKeyedFastDoubleElement(elements, key, val); |
| 1860 } | 1865 } |
| 1861 | 1866 |
| 1862 | 1867 |
| 1863 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( | 1868 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
| 1864 HStoreKeyedSpecializedArrayElement* instr) { | 1869 HStoreKeyedSpecializedArrayElement* instr) { |
| 1865 Representation representation(instr->value()->representation()); | 1870 Representation representation(instr->value()->representation()); |
| 1866 ElementsKind elements_kind = instr->elements_kind(); | 1871 ElementsKind elements_kind = instr->elements_kind(); |
| 1867 ASSERT( | 1872 ASSERT( |
| 1868 (representation.IsInteger32() && | 1873 (representation.IsInteger32() && |
| 1869 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1874 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1870 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1875 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1871 (representation.IsDouble() && | 1876 (representation.IsDouble() && |
| 1872 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1877 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1873 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1878 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1874 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1879 ASSERT(instr->external_pointer()->representation().IsExternal()); |
| 1875 ASSERT(instr->key()->representation().IsInteger32()); | 1880 ASSERT(instr->key()->representation().IsInteger32() || |
| 1881 instr->key()->representation().IsTagged()); |
| 1876 | 1882 |
| 1877 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1883 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1878 bool val_is_temp_register = | 1884 bool val_is_temp_register = |
| 1879 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | 1885 elements_kind == EXTERNAL_PIXEL_ELEMENTS || |
| 1880 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | 1886 elements_kind == EXTERNAL_FLOAT_ELEMENTS; |
| 1881 LOperand* val = val_is_temp_register | 1887 LOperand* val = val_is_temp_register |
| 1882 ? UseTempRegister(instr->value()) | 1888 ? UseTempRegister(instr->value()) |
| 1883 : UseRegister(instr->value()); | 1889 : UseRegister(instr->value()); |
| 1884 LOperand* key = UseRegisterOrConstant(instr->key()); | 1890 LOperand* key = UseRegisterOrConstant(instr->key()); |
| 1885 | 1891 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2214 | 2220 |
| 2215 | 2221 |
| 2216 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2222 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2217 LOperand* object = UseRegister(instr->object()); | 2223 LOperand* object = UseRegister(instr->object()); |
| 2218 LOperand* index = UseRegister(instr->index()); | 2224 LOperand* index = UseRegister(instr->index()); |
| 2219 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2225 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2220 } | 2226 } |
| 2221 | 2227 |
| 2222 | 2228 |
| 2223 } } // namespace v8::internal | 2229 } } // namespace v8::internal |
| OLD | NEW |