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 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 HLoadKeyedFastElement* instr) { | 1809 HLoadKeyedFastElement* instr) { |
1810 ASSERT(instr->representation().IsTagged()); | 1810 ASSERT(instr->representation().IsTagged()); |
1811 ASSERT(instr->key()->representation().IsInteger32()); | 1811 ASSERT(instr->key()->representation().IsInteger32()); |
1812 LOperand* obj = UseRegisterAtStart(instr->object()); | 1812 LOperand* obj = UseRegisterAtStart(instr->object()); |
1813 LOperand* key = UseRegisterAtStart(instr->key()); | 1813 LOperand* key = UseRegisterAtStart(instr->key()); |
1814 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1814 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
1815 return AssignEnvironment(DefineSameAsFirst(result)); | 1815 return AssignEnvironment(DefineSameAsFirst(result)); |
1816 } | 1816 } |
1817 | 1817 |
1818 | 1818 |
1819 LInstruction* LChunkBuilder::DoLoadPixelArrayElement( | 1819 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
1820 HLoadPixelArrayElement* instr) { | 1820 HLoadKeyedSpecializedArrayElement* instr) { |
1821 ASSERT(instr->representation().IsInteger32()); | 1821 ExternalArrayType array_type = instr->array_type(); |
| 1822 Representation representation(instr->representation()); |
| 1823 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
| 1824 (representation.IsDouble() && array_type == kExternalFloatArray)); |
1822 ASSERT(instr->key()->representation().IsInteger32()); | 1825 ASSERT(instr->key()->representation().IsInteger32()); |
1823 LOperand* external_pointer = | 1826 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1824 UseRegisterAtStart(instr->external_pointer()); | 1827 LOperand* key = UseRegister(instr->key()); |
1825 LOperand* key = UseRegisterAtStart(instr->key()); | 1828 LLoadKeyedSpecializedArrayElement* result = |
1826 LLoadPixelArrayElement* result = | 1829 new LLoadKeyedSpecializedArrayElement(external_pointer, key); |
1827 new LLoadPixelArrayElement(external_pointer, key); | 1830 LInstruction* load_instr = DefineAsRegister(result); |
1828 return DefineSameAsFirst(result); | 1831 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1832 // has an environment. |
| 1833 return (array_type == kExternalUnsignedIntArray) ? |
| 1834 AssignEnvironment(load_instr) : load_instr; |
1829 } | 1835 } |
1830 | 1836 |
1831 | 1837 |
1832 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1838 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
1833 LOperand* object = UseFixed(instr->object(), rdx); | 1839 LOperand* object = UseFixed(instr->object(), rdx); |
1834 LOperand* key = UseFixed(instr->key(), rax); | 1840 LOperand* key = UseFixed(instr->key(), rax); |
1835 | 1841 |
1836 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(object, key); | 1842 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(object, key); |
1837 return MarkAsCall(DefineFixed(result, rax), instr); | 1843 return MarkAsCall(DefineFixed(result, rax), instr); |
1838 } | 1844 } |
(...skipping 11 matching lines...) Expand all Loading... |
1850 ? UseTempRegister(instr->value()) | 1856 ? UseTempRegister(instr->value()) |
1851 : UseRegisterAtStart(instr->value()); | 1857 : UseRegisterAtStart(instr->value()); |
1852 LOperand* key = needs_write_barrier | 1858 LOperand* key = needs_write_barrier |
1853 ? UseTempRegister(instr->key()) | 1859 ? UseTempRegister(instr->key()) |
1854 : UseRegisterOrConstantAtStart(instr->key()); | 1860 : UseRegisterOrConstantAtStart(instr->key()); |
1855 | 1861 |
1856 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1862 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
1857 } | 1863 } |
1858 | 1864 |
1859 | 1865 |
1860 LInstruction* LChunkBuilder::DoStorePixelArrayElement( | 1866 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
1861 HStorePixelArrayElement* instr) { | 1867 HStoreKeyedSpecializedArrayElement* instr) { |
1862 ASSERT(instr->value()->representation().IsInteger32()); | 1868 Representation representation(instr->value()->representation()); |
| 1869 ExternalArrayType array_type = instr->array_type(); |
| 1870 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
| 1871 (representation.IsDouble() && array_type == kExternalFloatArray)); |
1863 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1872 ASSERT(instr->external_pointer()->representation().IsExternal()); |
1864 ASSERT(instr->key()->representation().IsInteger32()); | 1873 ASSERT(instr->key()->representation().IsInteger32()); |
1865 | 1874 |
1866 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1875 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1867 LOperand* val = UseTempRegister(instr->value()); | 1876 bool val_is_temp_register = array_type == kExternalPixelArray || |
| 1877 array_type == kExternalFloatArray; |
| 1878 LOperand* val = val_is_temp_register |
| 1879 ? UseTempRegister(instr->value()) |
| 1880 : UseRegister(instr->key()); |
1868 LOperand* key = UseRegister(instr->key()); | 1881 LOperand* key = UseRegister(instr->key()); |
1869 | 1882 |
1870 return new LStorePixelArrayElement(external_pointer, key, val); | 1883 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
| 1884 key, |
| 1885 val); |
1871 } | 1886 } |
1872 | 1887 |
1873 | 1888 |
1874 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1889 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
1875 LOperand* object = UseFixed(instr->object(), rdx); | 1890 LOperand* object = UseFixed(instr->object(), rdx); |
1876 LOperand* key = UseFixed(instr->key(), rcx); | 1891 LOperand* key = UseFixed(instr->key(), rcx); |
1877 LOperand* value = UseFixed(instr->value(), rax); | 1892 LOperand* value = UseFixed(instr->value(), rax); |
1878 | 1893 |
1879 ASSERT(instr->object()->representation().IsTagged()); | 1894 ASSERT(instr->object()->representation().IsTagged()); |
1880 ASSERT(instr->key()->representation().IsTagged()); | 1895 ASSERT(instr->key()->representation().IsTagged()); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 | 2095 |
2081 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2096 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2082 HEnvironment* outer = current_block_->last_environment()->outer(); | 2097 HEnvironment* outer = current_block_->last_environment()->outer(); |
2083 current_block_->UpdateEnvironment(outer); | 2098 current_block_->UpdateEnvironment(outer); |
2084 return NULL; | 2099 return NULL; |
2085 } | 2100 } |
2086 | 2101 |
2087 } } // namespace v8::internal | 2102 } } // namespace v8::internal |
2088 | 2103 |
2089 #endif // V8_TARGET_ARCH_X64 | 2104 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |