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 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 LOperand* key = UseFixed(instr->key(), a0); | 1837 LOperand* key = UseFixed(instr->key(), a0); |
1838 | 1838 |
1839 LInstruction* result = | 1839 LInstruction* result = |
1840 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0); | 1840 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0); |
1841 return MarkAsCall(result, instr); | 1841 return MarkAsCall(result, instr); |
1842 } | 1842 } |
1843 | 1843 |
1844 | 1844 |
1845 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 1845 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
1846 ElementsKind elements_kind = instr->elements_kind(); | 1846 ElementsKind elements_kind = instr->elements_kind(); |
1847 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1847 |
1848 LOperand* key = needs_write_barrier | 1848 if (!instr->is_external()) { |
1849 ? UseTempRegister(instr->key()) | 1849 ASSERT(instr->elements()->representation().IsTagged()); |
1850 : UseRegisterOrConstantAtStart(instr->key()); | 1850 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 1851 LOperand* object = NULL; |
| 1852 LOperand* val = NULL; |
| 1853 LOperand* key = NULL; |
| 1854 |
| 1855 if (instr->value()->representation().IsDouble()) { |
| 1856 object = UseRegisterAtStart(instr->elements()); |
| 1857 key = UseRegisterOrConstantAtStart(instr->key()); |
| 1858 val = UseTempRegister(instr->value()); |
| 1859 } else { |
| 1860 ASSERT(instr->value()->representation().IsTagged()); |
| 1861 object = UseTempRegister(instr->elements()); |
| 1862 val = needs_write_barrier ? UseTempRegister(instr->value()) |
| 1863 : UseRegisterAtStart(instr->value()); |
| 1864 key = needs_write_barrier ? UseTempRegister(instr->key()) |
| 1865 : UseRegisterOrConstantAtStart(instr->key()); |
| 1866 } |
| 1867 |
| 1868 return new(zone()) LStoreKeyed(object, key, val); |
| 1869 } |
| 1870 |
| 1871 ASSERT( |
| 1872 (instr->value()->representation().IsInteger32() && |
| 1873 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1874 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1875 (instr->value()->representation().IsDouble() && |
| 1876 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1877 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1878 ASSERT(instr->elements()->representation().IsExternal()); |
1851 bool val_is_temp_register = | 1879 bool val_is_temp_register = |
1852 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | 1880 elements_kind == EXTERNAL_PIXEL_ELEMENTS || |
1853 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | 1881 elements_kind == EXTERNAL_FLOAT_ELEMENTS; |
1854 LOperand* val = val_is_temp_register || needs_write_barrier | 1882 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) |
1855 ? UseTempRegister(instr->value()) | |
1856 : UseRegister(instr->value()); | 1883 : UseRegister(instr->value()); |
1857 LStoreKeyed* result = NULL; | 1884 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
1858 if (!instr->is_external()) { | 1885 LOperand* external_pointer = UseRegister(instr->elements()); |
1859 ASSERT(instr->elements()->representation().IsTagged()); | |
1860 | 1886 |
1861 LOperand* object = NULL; | 1887 return new(zone()) LStoreKeyed(external_pointer, key, val); |
1862 if (instr->value()->representation().IsDouble()) { | |
1863 object = UseRegisterAtStart(instr->elements()); | |
1864 } else { | |
1865 ASSERT(instr->value()->representation().IsTagged()); | |
1866 object = UseTempRegister(instr->elements()); | |
1867 } | |
1868 | |
1869 result = new(zone()) LStoreKeyed(object, key, val); | |
1870 } else { | |
1871 ASSERT( | |
1872 (instr->value()->representation().IsInteger32() && | |
1873 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | |
1874 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
1875 (instr->value()->representation().IsDouble() && | |
1876 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | |
1877 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | |
1878 ASSERT(instr->elements()->representation().IsExternal()); | |
1879 | |
1880 LOperand* external_pointer = UseRegister(instr->elements()); | |
1881 result = new(zone()) LStoreKeyed(external_pointer, key, val); | |
1882 } | |
1883 | |
1884 ASSERT(result != NULL); | |
1885 return result; | |
1886 } | 1888 } |
1887 | 1889 |
1888 | 1890 |
1889 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1891 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
1890 LOperand* obj = UseFixed(instr->object(), a2); | 1892 LOperand* obj = UseFixed(instr->object(), a2); |
1891 LOperand* key = UseFixed(instr->key(), a1); | 1893 LOperand* key = UseFixed(instr->key(), a1); |
1892 LOperand* val = UseFixed(instr->value(), a0); | 1894 LOperand* val = UseFixed(instr->value(), a0); |
1893 | 1895 |
1894 ASSERT(instr->object()->representation().IsTagged()); | 1896 ASSERT(instr->object()->representation().IsTagged()); |
1895 ASSERT(instr->key()->representation().IsTagged()); | 1897 ASSERT(instr->key()->representation().IsTagged()); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2209 | 2211 |
2210 | 2212 |
2211 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2213 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2212 LOperand* object = UseRegister(instr->object()); | 2214 LOperand* object = UseRegister(instr->object()); |
2213 LOperand* index = UseRegister(instr->index()); | 2215 LOperand* index = UseRegister(instr->index()); |
2214 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2216 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2215 } | 2217 } |
2216 | 2218 |
2217 | 2219 |
2218 } } // namespace v8::internal | 2220 } } // namespace v8::internal |
OLD | NEW |