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