Chromium Code Reviews| 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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1817 ASSERT(instr->key()->representation().IsInteger32()); | 1817 ASSERT(instr->key()->representation().IsInteger32()); |
| 1818 LOperand* obj = UseRegisterAtStart(instr->object()); | 1818 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1819 LOperand* key = UseRegisterAtStart(instr->key()); | 1819 LOperand* key = UseRegisterAtStart(instr->key()); |
| 1820 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1820 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
| 1821 return AssignEnvironment(DefineSameAsFirst(result)); | 1821 return AssignEnvironment(DefineSameAsFirst(result)); |
| 1822 } | 1822 } |
| 1823 | 1823 |
| 1824 | 1824 |
| 1825 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1825 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
| 1826 HLoadKeyedSpecializedArrayElement* instr) { | 1826 HLoadKeyedSpecializedArrayElement* instr) { |
| 1827 // TODO(danno): Add support for other external array types. | 1827 ExternalArrayType array_type = instr->array_type(); |
| 1828 if (instr->array_type() != kExternalPixelArray) { | 1828 Representation representation(instr->representation()); |
| 1829 Abort("unsupported load for external array type."); | 1829 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
| 1830 return NULL; | 1830 (representation.IsDouble() && array_type == kExternalFloatArray)); |
| 1831 } | |
| 1832 | |
| 1833 ASSERT(instr->representation().IsInteger32()); | |
| 1834 ASSERT(instr->key()->representation().IsInteger32()); | 1831 ASSERT(instr->key()->representation().IsInteger32()); |
| 1835 LOperand* external_pointer = | 1832 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1836 UseRegisterAtStart(instr->external_pointer()); | 1833 LOperand* key = UseRegister(instr->key()); |
| 1837 LOperand* key = UseRegisterAtStart(instr->key()); | |
| 1838 LLoadKeyedSpecializedArrayElement* result = | 1834 LLoadKeyedSpecializedArrayElement* result = |
| 1839 new LLoadKeyedSpecializedArrayElement(external_pointer, | 1835 new LLoadKeyedSpecializedArrayElement(external_pointer, key); |
| 1840 key); | 1836 LInstruction* load_instr = DefineAsRegister(result); |
| 1841 return DefineAsRegister(result); | 1837 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1838 // has an environment. | |
| 1839 return (array_type == kExternalUnsignedIntArray) ? | |
| 1840 AssignEnvironment(load_instr) : load_instr; | |
| 1842 } | 1841 } |
| 1843 | 1842 |
| 1844 | 1843 |
| 1845 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1844 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1846 LOperand* object = UseFixed(instr->object(), r1); | 1845 LOperand* object = UseFixed(instr->object(), r1); |
| 1847 LOperand* key = UseFixed(instr->key(), r0); | 1846 LOperand* key = UseFixed(instr->key(), r0); |
| 1848 | 1847 |
| 1849 LInstruction* result = | 1848 LInstruction* result = |
| 1850 DefineFixed(new LLoadKeyedGeneric(object, key), r0); | 1849 DefineFixed(new LLoadKeyedGeneric(object, key), r0); |
| 1851 return MarkAsCall(result, instr); | 1850 return MarkAsCall(result, instr); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1866 LOperand* key = needs_write_barrier | 1865 LOperand* key = needs_write_barrier |
| 1867 ? UseTempRegister(instr->key()) | 1866 ? UseTempRegister(instr->key()) |
| 1868 : UseRegisterOrConstantAtStart(instr->key()); | 1867 : UseRegisterOrConstantAtStart(instr->key()); |
| 1869 | 1868 |
| 1870 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1869 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
| 1871 } | 1870 } |
| 1872 | 1871 |
| 1873 | 1872 |
| 1874 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( | 1873 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
| 1875 HStoreKeyedSpecializedArrayElement* instr) { | 1874 HStoreKeyedSpecializedArrayElement* instr) { |
| 1876 // TODO(danno): Add support for other external array types. | 1875 Representation representation(instr->value()->representation()); |
| 1877 if (instr->array_type() != kExternalPixelArray) { | 1876 ExternalArrayType array_type = instr->array_type(); |
| 1878 Abort("unsupported store for external array type."); | 1877 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
| 1879 return NULL; | 1878 (representation.IsDouble() && array_type == kExternalFloatArray)); |
| 1880 } | |
| 1881 | |
| 1882 ASSERT(instr->value()->representation().IsInteger32()); | |
| 1883 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1879 ASSERT(instr->external_pointer()->representation().IsExternal()); |
| 1884 ASSERT(instr->key()->representation().IsInteger32()); | 1880 ASSERT(instr->key()->representation().IsInteger32()); |
| 1885 | 1881 |
| 1886 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1882 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1887 LOperand* value = UseTempRegister(instr->value()); // changed by clamp. | 1883 bool val_is_temp_register = array_type == kExternalPixelArray || |
| 1884 array_type == kExternalFloatArray; | |
| 1885 LOperand* val = val_is_temp_register | |
| 1886 ? UseTempRegister(instr->value()) | |
| 1887 : UseRegister(instr->key()); | |
|
Mads Ager (chromium)
2011/04/06 16:45:15
key -> value.
This should fail a test that Jakob
| |
| 1888 LOperand* key = UseRegister(instr->key()); | 1888 LOperand* key = UseRegister(instr->key()); |
| 1889 | 1889 |
| 1890 return new LStoreKeyedSpecializedArrayElement(external_pointer, | 1890 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
| 1891 key, | 1891 key, |
| 1892 value); | 1892 val); |
| 1893 } | 1893 } |
| 1894 | 1894 |
| 1895 | 1895 |
| 1896 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1896 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 1897 LOperand* obj = UseFixed(instr->object(), r2); | 1897 LOperand* obj = UseFixed(instr->object(), r2); |
| 1898 LOperand* key = UseFixed(instr->key(), r1); | 1898 LOperand* key = UseFixed(instr->key(), r1); |
| 1899 LOperand* val = UseFixed(instr->value(), r0); | 1899 LOperand* val = UseFixed(instr->value(), r0); |
| 1900 | 1900 |
| 1901 ASSERT(instr->object()->representation().IsTagged()); | 1901 ASSERT(instr->object()->representation().IsTagged()); |
| 1902 ASSERT(instr->key()->representation().IsTagged()); | 1902 ASSERT(instr->key()->representation().IsTagged()); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2097 | 2097 |
| 2098 | 2098 |
| 2099 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2099 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2100 HEnvironment* outer = current_block_->last_environment()->outer(); | 2100 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2101 current_block_->UpdateEnvironment(outer); | 2101 current_block_->UpdateEnvironment(outer); |
| 2102 return NULL; | 2102 return NULL; |
| 2103 } | 2103 } |
| 2104 | 2104 |
| 2105 | 2105 |
| 2106 } } // namespace v8::internal | 2106 } } // namespace v8::internal |
| OLD | NEW |