OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 HLoadKeyedFastElement* instr) { | 1794 HLoadKeyedFastElement* instr) { |
1795 ASSERT(instr->representation().IsTagged()); | 1795 ASSERT(instr->representation().IsTagged()); |
1796 ASSERT(instr->key()->representation().IsInteger32()); | 1796 ASSERT(instr->key()->representation().IsInteger32()); |
1797 LOperand* obj = UseRegisterAtStart(instr->object()); | 1797 LOperand* obj = UseRegisterAtStart(instr->object()); |
1798 LOperand* key = UseRegisterAtStart(instr->key()); | 1798 LOperand* key = UseRegisterAtStart(instr->key()); |
1799 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1799 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
1800 return AssignEnvironment(DefineSameAsFirst(result)); | 1800 return AssignEnvironment(DefineSameAsFirst(result)); |
1801 } | 1801 } |
1802 | 1802 |
1803 | 1803 |
1804 LInstruction* LChunkBuilder::DoLoadPixelArrayElement( | 1804 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
1805 HLoadPixelArrayElement* instr) { | 1805 HLoadKeyedSpecializedArrayElement* instr) { |
1806 ASSERT(instr->representation().IsInteger32()); | 1806 ExternalArrayType array_type = instr->array_type(); |
| 1807 Representation representation(instr->representation()); |
| 1808 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
| 1809 (representation.IsDouble() && array_type == kExternalFloatArray)); |
1807 ASSERT(instr->key()->representation().IsInteger32()); | 1810 ASSERT(instr->key()->representation().IsInteger32()); |
1808 LOperand* external_pointer = | 1811 LOperand* external_pointer = |
1809 UseRegisterAtStart(instr->external_pointer()); | 1812 UseRegisterAtStart(instr->external_pointer()); |
1810 LOperand* key = UseRegisterAtStart(instr->key()); | 1813 LOperand* key = UseRegisterAtStart(instr->key()); |
1811 LLoadPixelArrayElement* result = | 1814 LLoadKeyedSpecializedArrayElement* result = |
1812 new LLoadPixelArrayElement(external_pointer, key); | 1815 new LLoadKeyedSpecializedArrayElement(external_pointer, |
1813 return DefineSameAsFirst(result); | 1816 key, |
| 1817 array_type); |
| 1818 LInstruction* load_instr = array_type != kExternalFloatArray ? |
| 1819 DefineSameAsFirst(result) : |
| 1820 DefineAsRegister(result); |
| 1821 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1822 // has an environment. |
| 1823 return (array_type == kExternalUnsignedIntArray) ? |
| 1824 AssignEnvironment(load_instr) : load_instr; |
1814 } | 1825 } |
1815 | 1826 |
1816 | 1827 |
1817 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1828 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
1818 LOperand* object = UseFixed(instr->object(), rdx); | 1829 LOperand* object = UseFixed(instr->object(), rdx); |
1819 LOperand* key = UseFixed(instr->key(), rax); | 1830 LOperand* key = UseFixed(instr->key(), rax); |
1820 | 1831 |
1821 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(object, key); | 1832 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(object, key); |
1822 return MarkAsCall(DefineFixed(result, rax), instr); | 1833 return MarkAsCall(DefineFixed(result, rax), instr); |
1823 } | 1834 } |
(...skipping 11 matching lines...) Expand all Loading... |
1835 ? UseTempRegister(instr->value()) | 1846 ? UseTempRegister(instr->value()) |
1836 : UseRegisterAtStart(instr->value()); | 1847 : UseRegisterAtStart(instr->value()); |
1837 LOperand* key = needs_write_barrier | 1848 LOperand* key = needs_write_barrier |
1838 ? UseTempRegister(instr->key()) | 1849 ? UseTempRegister(instr->key()) |
1839 : UseRegisterOrConstantAtStart(instr->key()); | 1850 : UseRegisterOrConstantAtStart(instr->key()); |
1840 | 1851 |
1841 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1852 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
1842 } | 1853 } |
1843 | 1854 |
1844 | 1855 |
1845 LInstruction* LChunkBuilder::DoStorePixelArrayElement( | 1856 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
1846 HStorePixelArrayElement* instr) { | 1857 HStoreKeyedSpecializedArrayElement* instr) { |
1847 ASSERT(instr->value()->representation().IsInteger32()); | 1858 Representation representation(instr->value()->representation()); |
| 1859 ASSERT((representation.IsInteger32() && |
| 1860 (instr->array_type() != kExternalFloatArray)) || |
| 1861 (representation.IsDouble() && |
| 1862 (instr->array_type() == kExternalFloatArray))); |
1848 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1863 ASSERT(instr->external_pointer()->representation().IsExternal()); |
1849 ASSERT(instr->key()->representation().IsInteger32()); | 1864 ASSERT(instr->key()->representation().IsInteger32()); |
1850 | 1865 |
1851 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1866 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1852 LOperand* val = UseTempRegister(instr->value()); | 1867 LOperand* val = UseTempRegister(instr->value()); |
1853 LOperand* key = UseRegister(instr->key()); | 1868 LOperand* key = UseRegister(instr->key()); |
1854 | 1869 |
1855 return new LStorePixelArrayElement(external_pointer, key, val); | 1870 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
| 1871 key, |
| 1872 val, |
| 1873 instr->array_type()); |
1856 } | 1874 } |
1857 | 1875 |
1858 | 1876 |
1859 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1877 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
1860 LOperand* object = UseFixed(instr->object(), rdx); | 1878 LOperand* object = UseFixed(instr->object(), rdx); |
1861 LOperand* key = UseFixed(instr->key(), rcx); | 1879 LOperand* key = UseFixed(instr->key(), rcx); |
1862 LOperand* value = UseFixed(instr->value(), rax); | 1880 LOperand* value = UseFixed(instr->value(), rax); |
1863 | 1881 |
1864 ASSERT(instr->object()->representation().IsTagged()); | 1882 ASSERT(instr->object()->representation().IsTagged()); |
1865 ASSERT(instr->key()->representation().IsTagged()); | 1883 ASSERT(instr->key()->representation().IsTagged()); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 | 2083 |
2066 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2084 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2067 HEnvironment* outer = current_block_->last_environment()->outer(); | 2085 HEnvironment* outer = current_block_->last_environment()->outer(); |
2068 current_block_->UpdateEnvironment(outer); | 2086 current_block_->UpdateEnvironment(outer); |
2069 return NULL; | 2087 return NULL; |
2070 } | 2088 } |
2071 | 2089 |
2072 } } // namespace v8::internal | 2090 } } // namespace v8::internal |
2073 | 2091 |
2074 #endif // V8_TARGET_ARCH_X64 | 2092 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |