| 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 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 ASSERT(instr->key()->representation().IsInteger32()); | 1833 ASSERT(instr->key()->representation().IsInteger32()); |
| 1834 LOperand* obj = UseRegisterAtStart(instr->object()); | 1834 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1835 LOperand* key = UseRegisterAtStart(instr->key()); | 1835 LOperand* key = UseRegisterAtStart(instr->key()); |
| 1836 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1836 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
| 1837 return AssignEnvironment(DefineSameAsFirst(result)); | 1837 return AssignEnvironment(DefineSameAsFirst(result)); |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 | 1840 |
| 1841 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1841 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
| 1842 HLoadKeyedSpecializedArrayElement* instr) { | 1842 HLoadKeyedSpecializedArrayElement* instr) { |
| 1843 // TODO(danno): Add support for other external array types. | 1843 ExternalArrayType array_type = instr->array_type(); |
| 1844 if (instr->array_type() != kExternalPixelArray) { | 1844 Representation representation(instr->representation()); |
| 1845 Abort("unsupported load for external array type."); | 1845 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
| 1846 return NULL; | 1846 (representation.IsDouble() && array_type == kExternalFloatArray)); |
| 1847 } | |
| 1848 | |
| 1849 ASSERT(instr->representation().IsInteger32()); | |
| 1850 ASSERT(instr->key()->representation().IsInteger32()); | 1847 ASSERT(instr->key()->representation().IsInteger32()); |
| 1851 LOperand* external_pointer = | 1848 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1852 UseRegisterAtStart(instr->external_pointer()); | 1849 LOperand* key = UseRegister(instr->key()); |
| 1853 LOperand* key = UseRegisterAtStart(instr->key()); | |
| 1854 LLoadKeyedSpecializedArrayElement* result = | 1850 LLoadKeyedSpecializedArrayElement* result = |
| 1855 new LLoadKeyedSpecializedArrayElement(external_pointer, | 1851 new LLoadKeyedSpecializedArrayElement(external_pointer, key); |
| 1856 key); | 1852 LInstruction* load_instr = DefineAsRegister(result); |
| 1857 return DefineAsRegister(result); | 1853 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1854 // has an environment. |
| 1855 return (array_type == kExternalUnsignedIntArray) ? |
| 1856 AssignEnvironment(load_instr) : load_instr; |
| 1858 } | 1857 } |
| 1859 | 1858 |
| 1860 | 1859 |
| 1861 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1860 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1862 LOperand* object = UseFixed(instr->object(), r1); | 1861 LOperand* object = UseFixed(instr->object(), r1); |
| 1863 LOperand* key = UseFixed(instr->key(), r0); | 1862 LOperand* key = UseFixed(instr->key(), r0); |
| 1864 | 1863 |
| 1865 LInstruction* result = | 1864 LInstruction* result = |
| 1866 DefineFixed(new LLoadKeyedGeneric(object, key), r0); | 1865 DefineFixed(new LLoadKeyedGeneric(object, key), r0); |
| 1867 return MarkAsCall(result, instr); | 1866 return MarkAsCall(result, instr); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1882 LOperand* key = needs_write_barrier | 1881 LOperand* key = needs_write_barrier |
| 1883 ? UseTempRegister(instr->key()) | 1882 ? UseTempRegister(instr->key()) |
| 1884 : UseRegisterOrConstantAtStart(instr->key()); | 1883 : UseRegisterOrConstantAtStart(instr->key()); |
| 1885 | 1884 |
| 1886 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1885 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
| 1887 } | 1886 } |
| 1888 | 1887 |
| 1889 | 1888 |
| 1890 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( | 1889 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
| 1891 HStoreKeyedSpecializedArrayElement* instr) { | 1890 HStoreKeyedSpecializedArrayElement* instr) { |
| 1892 // TODO(danno): Add support for other external array types. | 1891 Representation representation(instr->value()->representation()); |
| 1893 if (instr->array_type() != kExternalPixelArray) { | 1892 ExternalArrayType array_type = instr->array_type(); |
| 1894 Abort("unsupported store for external array type."); | 1893 ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
| 1895 return NULL; | 1894 (representation.IsDouble() && array_type == kExternalFloatArray)); |
| 1896 } | |
| 1897 | |
| 1898 ASSERT(instr->value()->representation().IsInteger32()); | |
| 1899 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1895 ASSERT(instr->external_pointer()->representation().IsExternal()); |
| 1900 ASSERT(instr->key()->representation().IsInteger32()); | 1896 ASSERT(instr->key()->representation().IsInteger32()); |
| 1901 | 1897 |
| 1902 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1898 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1903 LOperand* value = UseTempRegister(instr->value()); // changed by clamp. | 1899 bool val_is_temp_register = array_type == kExternalPixelArray || |
| 1900 array_type == kExternalFloatArray; |
| 1901 LOperand* val = val_is_temp_register |
| 1902 ? UseTempRegister(instr->value()) |
| 1903 : UseRegister(instr->value()); |
| 1904 LOperand* key = UseRegister(instr->key()); | 1904 LOperand* key = UseRegister(instr->key()); |
| 1905 | 1905 |
| 1906 return new LStoreKeyedSpecializedArrayElement(external_pointer, | 1906 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
| 1907 key, | 1907 key, |
| 1908 value); | 1908 val); |
| 1909 } | 1909 } |
| 1910 | 1910 |
| 1911 | 1911 |
| 1912 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1912 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 1913 LOperand* obj = UseFixed(instr->object(), r2); | 1913 LOperand* obj = UseFixed(instr->object(), r2); |
| 1914 LOperand* key = UseFixed(instr->key(), r1); | 1914 LOperand* key = UseFixed(instr->key(), r1); |
| 1915 LOperand* val = UseFixed(instr->value(), r0); | 1915 LOperand* val = UseFixed(instr->value(), r0); |
| 1916 | 1916 |
| 1917 ASSERT(instr->object()->representation().IsTagged()); | 1917 ASSERT(instr->object()->representation().IsTagged()); |
| 1918 ASSERT(instr->key()->representation().IsTagged()); | 1918 ASSERT(instr->key()->representation().IsTagged()); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 | 2111 |
| 2112 | 2112 |
| 2113 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2113 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2114 HEnvironment* outer = current_block_->last_environment()->outer(); | 2114 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2115 current_block_->UpdateEnvironment(outer); | 2115 current_block_->UpdateEnvironment(outer); |
| 2116 return NULL; | 2116 return NULL; |
| 2117 } | 2117 } |
| 2118 | 2118 |
| 2119 | 2119 |
| 2120 } } // namespace v8::internal | 2120 } } // namespace v8::internal |
| OLD | NEW |