Chromium Code Reviews| 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 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1831 HLoadExternalArrayPointer* instr) { | 1831 HLoadExternalArrayPointer* instr) { |
| 1832 LOperand* input = UseRegisterAtStart(instr->value()); | 1832 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1833 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 1833 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 1834 } | 1834 } |
| 1835 | 1835 |
| 1836 | 1836 |
| 1837 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 1837 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 1838 ASSERT(instr->key()->representation().IsInteger32() || | 1838 ASSERT(instr->key()->representation().IsInteger32() || |
| 1839 instr->key()->representation().IsTagged()); | 1839 instr->key()->representation().IsTagged()); |
| 1840 ElementsKind elements_kind = instr->elements_kind(); | 1840 ElementsKind elements_kind = instr->elements_kind(); |
| 1841 bool clobbers_key = instr->key()->representation().IsTagged(); | 1841 bool clobbers_key = ArrayOpClobbersKey<HLoadKeyed>(instr); |
| 1842 LOperand* key = clobbers_key | 1842 LOperand* key = clobbers_key |
| 1843 ? UseTempRegister(instr->key()) | 1843 ? UseTempRegister(instr->key()) |
| 1844 : UseRegisterOrConstantAtStart(instr->key()); | 1844 : UseRegisterOrConstantAtStart(instr->key()); |
| 1845 LLoadKeyed* result = NULL; | 1845 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1846 | 1846 LLoadKeyed* result = new(zone()) LLoadKeyed(elements, key); |
| 1847 if (!instr->is_external()) { | 1847 if (instr->is_external()) { |
|
danno
2012/11/07 22:34:38
Wrap this in #if DEBUG like you did elsewhere?
mvstanton
2012/11/09 09:43:13
Done.
| |
| 1848 LOperand* obj = UseRegisterAtStart(instr->elements()); | |
| 1849 result = new(zone()) LLoadKeyed(obj, key); | |
| 1850 } else { | |
| 1851 ASSERT( | 1848 ASSERT( |
| 1852 (instr->representation().IsInteger32() && | 1849 (instr->representation().IsInteger32() && |
| 1853 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1850 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1854 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1851 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1855 (instr->representation().IsDouble() && | 1852 (instr->representation().IsDouble() && |
| 1856 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1853 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1857 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1854 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1858 LOperand* external_pointer = UseRegister(instr->elements()); | |
| 1859 result = new(zone()) LLoadKeyed(external_pointer, key); | |
| 1860 } | 1855 } |
| 1861 | 1856 |
| 1862 DefineAsRegister(result); | 1857 DefineAsRegister(result); |
| 1863 bool can_deoptimize = instr->RequiresHoleCheck() || | 1858 bool can_deoptimize = instr->RequiresHoleCheck() || |
| 1864 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 1859 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); |
| 1865 // An unsigned int array load might overflow and cause a deopt, make sure it | 1860 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1866 // has an environment. | 1861 // has an environment. |
| 1867 return can_deoptimize ? AssignEnvironment(result) : result; | 1862 return can_deoptimize ? AssignEnvironment(result) : result; |
| 1868 } | 1863 } |
| 1869 | 1864 |
| 1870 | 1865 |
| 1871 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1866 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1872 LOperand* object = UseFixed(instr->object(), rdx); | 1867 LOperand* object = UseFixed(instr->object(), rdx); |
| 1873 LOperand* key = UseFixed(instr->key(), rax); | 1868 LOperand* key = UseFixed(instr->key(), rax); |
| 1874 | 1869 |
| 1875 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); | 1870 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); |
| 1876 return MarkAsCall(DefineFixed(result, rax), instr); | 1871 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1877 } | 1872 } |
| 1878 | 1873 |
| 1879 | 1874 |
| 1880 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 1875 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 1881 ElementsKind elements_kind = instr->elements_kind(); | |
| 1882 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1876 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 1883 bool clobbers_key = instr->key()->representation().IsTagged(); | 1877 bool clobbers_key = ArrayOpClobbersKey<HStoreKeyed>(instr); |
| 1884 LOperand* key = (clobbers_key || needs_write_barrier) | 1878 LOperand* key = (clobbers_key || needs_write_barrier) |
| 1885 ? UseTempRegister(instr->key()) | 1879 ? UseTempRegister(instr->key()) |
| 1886 : UseRegisterOrConstantAtStart(instr->key()); | 1880 : UseRegisterOrConstantAtStart(instr->key()); |
| 1887 bool val_is_temp_register = | 1881 LOperand* val = needs_write_barrier |
| 1888 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | |
| 1889 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | |
| 1890 LOperand* val = (needs_write_barrier || val_is_temp_register) | |
| 1891 ? UseTempRegister(instr->value()) | 1882 ? UseTempRegister(instr->value()) |
| 1892 : UseRegisterAtStart(instr->value()); | 1883 : UseRegisterAtStart(instr->value()); |
| 1893 LStoreKeyed* result = NULL; | 1884 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1894 | 1885 |
| 1886 #ifdef DEBUG | |
| 1895 if (!instr->is_external()) { | 1887 if (!instr->is_external()) { |
| 1896 ASSERT(instr->elements()->representation().IsTagged()); | 1888 ASSERT(instr->elements()->representation().IsTagged()); |
| 1897 | |
| 1898 LOperand* object = NULL; | |
| 1899 if (instr->value()->representation().IsDouble()) { | |
| 1900 object = UseRegisterAtStart(instr->elements()); | |
| 1901 } else { | |
| 1902 ASSERT(instr->value()->representation().IsTagged()); | |
| 1903 object = UseTempRegister(instr->elements()); | |
| 1904 } | |
| 1905 | |
| 1906 result = new(zone()) LStoreKeyed(object, key, val); | |
| 1907 } else { | 1889 } else { |
| 1890 ElementsKind elements_kind = instr->elements_kind(); | |
| 1908 ASSERT( | 1891 ASSERT( |
| 1909 (instr->value()->representation().IsInteger32() && | 1892 (instr->value()->representation().IsInteger32() && |
| 1910 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1893 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1911 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1894 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1912 (instr->value()->representation().IsDouble() && | 1895 (instr->value()->representation().IsDouble() && |
| 1913 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1896 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1914 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1897 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1915 ASSERT(instr->elements()->representation().IsExternal()); | 1898 ASSERT(instr->elements()->representation().IsExternal()); |
| 1899 } | |
| 1900 #endif | |
| 1916 | 1901 |
| 1917 LOperand* external_pointer = UseRegister(instr->elements()); | 1902 LStoreKeyed* result = new(zone()) LStoreKeyed(elements, key, val); |
| 1918 result = new(zone()) LStoreKeyed(external_pointer, key, val); | |
| 1919 } | |
| 1920 | |
| 1921 ASSERT(result != NULL); | 1903 ASSERT(result != NULL); |
| 1922 return result; | 1904 return result; |
| 1923 } | 1905 } |
| 1924 | 1906 |
| 1925 | 1907 |
| 1926 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1908 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 1927 LOperand* object = UseFixed(instr->object(), rdx); | 1909 LOperand* object = UseFixed(instr->object(), rdx); |
| 1928 LOperand* key = UseFixed(instr->key(), rcx); | 1910 LOperand* key = UseFixed(instr->key(), rcx); |
| 1929 LOperand* value = UseFixed(instr->value(), rax); | 1911 LOperand* value = UseFixed(instr->value(), rax); |
| 1930 | 1912 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2253 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2235 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2254 LOperand* object = UseRegister(instr->object()); | 2236 LOperand* object = UseRegister(instr->object()); |
| 2255 LOperand* index = UseTempRegister(instr->index()); | 2237 LOperand* index = UseTempRegister(instr->index()); |
| 2256 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2238 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2257 } | 2239 } |
| 2258 | 2240 |
| 2259 | 2241 |
| 2260 } } // namespace v8::internal | 2242 } } // namespace v8::internal |
| 2261 | 2243 |
| 2262 #endif // V8_TARGET_ARCH_X64 | 2244 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |