| 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 HLoadExternalArrayPointer* instr) { | 1837 HLoadExternalArrayPointer* instr) { |
| 1838 LOperand* input = UseRegisterAtStart(instr->value()); | 1838 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1839 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 1839 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 1840 } | 1840 } |
| 1841 | 1841 |
| 1842 | 1842 |
| 1843 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 1843 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 1844 ASSERT(instr->key()->representation().IsInteger32() || | 1844 ASSERT(instr->key()->representation().IsInteger32() || |
| 1845 instr->key()->representation().IsTagged()); | 1845 instr->key()->representation().IsTagged()); |
| 1846 ElementsKind elements_kind = instr->elements_kind(); | 1846 ElementsKind elements_kind = instr->elements_kind(); |
| 1847 bool clobbers_key = ArrayOpClobbersKey<HLoadKeyed>(instr); | 1847 bool clobbers_key = instr->key()->representation().IsTagged(); |
| 1848 LOperand* key = clobbers_key | 1848 LOperand* key = clobbers_key |
| 1849 ? UseTempRegister(instr->key()) | 1849 ? UseTempRegister(instr->key()) |
| 1850 : UseRegisterOrConstantAtStart(instr->key()); | 1850 : UseRegisterOrConstantAtStart(instr->key()); |
| 1851 LOperand* elements = UseRegisterAtStart(instr->elements()); | 1851 LLoadKeyed* result = NULL; |
| 1852 LLoadKeyed* result = new(zone()) LLoadKeyed(elements, key); | |
| 1853 | 1852 |
| 1854 #ifdef DEBUG | 1853 if (!instr->is_external()) { |
| 1855 if (instr->is_external()) { | 1854 LOperand* obj = UseRegisterAtStart(instr->elements()); |
| 1855 result = new(zone()) LLoadKeyed(obj, key); |
| 1856 } else { |
| 1856 ASSERT( | 1857 ASSERT( |
| 1857 (instr->representation().IsInteger32() && | 1858 (instr->representation().IsInteger32() && |
| 1858 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1859 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1859 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1860 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1860 (instr->representation().IsDouble() && | 1861 (instr->representation().IsDouble() && |
| 1861 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1862 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1862 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1863 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1864 LOperand* external_pointer = UseRegister(instr->elements()); |
| 1865 result = new(zone()) LLoadKeyed(external_pointer, key); |
| 1863 } | 1866 } |
| 1864 #endif | |
| 1865 | 1867 |
| 1866 DefineAsRegister(result); | 1868 DefineAsRegister(result); |
| 1867 bool can_deoptimize = instr->RequiresHoleCheck() || | 1869 bool can_deoptimize = instr->RequiresHoleCheck() || |
| 1868 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 1870 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); |
| 1869 // An unsigned int array load might overflow and cause a deopt, make sure it | 1871 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1870 // has an environment. | 1872 // has an environment. |
| 1871 return can_deoptimize ? AssignEnvironment(result) : result; | 1873 return can_deoptimize ? AssignEnvironment(result) : result; |
| 1872 } | 1874 } |
| 1873 | 1875 |
| 1874 | 1876 |
| 1875 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1877 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1876 LOperand* object = UseFixed(instr->object(), rdx); | 1878 LOperand* object = UseFixed(instr->object(), rdx); |
| 1877 LOperand* key = UseFixed(instr->key(), rax); | 1879 LOperand* key = UseFixed(instr->key(), rax); |
| 1878 | 1880 |
| 1879 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); | 1881 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); |
| 1880 return MarkAsCall(DefineFixed(result, rax), instr); | 1882 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1881 } | 1883 } |
| 1882 | 1884 |
| 1883 | 1885 |
| 1884 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 1886 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 1887 ElementsKind elements_kind = instr->elements_kind(); |
| 1885 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1888 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 1886 bool clobbers_key = ArrayOpClobbersKey<HStoreKeyed>(instr); | 1889 bool clobbers_key = instr->key()->representation().IsTagged(); |
| 1887 LOperand* key = (clobbers_key || needs_write_barrier) | 1890 LOperand* key = (clobbers_key || needs_write_barrier) |
| 1888 ? UseTempRegister(instr->key()) | 1891 ? UseTempRegister(instr->key()) |
| 1889 : UseRegisterOrConstantAtStart(instr->key()); | 1892 : UseRegisterOrConstantAtStart(instr->key()); |
| 1890 LOperand* val = needs_write_barrier | 1893 bool val_is_temp_register = |
| 1894 elements_kind == EXTERNAL_PIXEL_ELEMENTS || |
| 1895 elements_kind == EXTERNAL_FLOAT_ELEMENTS; |
| 1896 LOperand* val = (needs_write_barrier || val_is_temp_register) |
| 1891 ? UseTempRegister(instr->value()) | 1897 ? UseTempRegister(instr->value()) |
| 1892 : UseRegisterAtStart(instr->value()); | 1898 : UseRegisterAtStart(instr->value()); |
| 1893 LOperand* elements = UseRegisterAtStart(instr->elements()); | 1899 LStoreKeyed* result = NULL; |
| 1894 | 1900 |
| 1895 #ifdef DEBUG | |
| 1896 if (!instr->is_external()) { | 1901 if (!instr->is_external()) { |
| 1897 ASSERT(instr->elements()->representation().IsTagged()); | 1902 ASSERT(instr->elements()->representation().IsTagged()); |
| 1903 |
| 1904 LOperand* object = NULL; |
| 1905 if (instr->value()->representation().IsDouble()) { |
| 1906 object = UseRegisterAtStart(instr->elements()); |
| 1907 } else { |
| 1908 ASSERT(instr->value()->representation().IsTagged()); |
| 1909 object = UseTempRegister(instr->elements()); |
| 1910 } |
| 1911 |
| 1912 result = new(zone()) LStoreKeyed(object, key, val); |
| 1898 } else { | 1913 } else { |
| 1899 ElementsKind elements_kind = instr->elements_kind(); | |
| 1900 ASSERT( | 1914 ASSERT( |
| 1901 (instr->value()->representation().IsInteger32() && | 1915 (instr->value()->representation().IsInteger32() && |
| 1902 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1916 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1903 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1917 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1904 (instr->value()->representation().IsDouble() && | 1918 (instr->value()->representation().IsDouble() && |
| 1905 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1919 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1906 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1920 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1907 ASSERT(instr->elements()->representation().IsExternal()); | 1921 ASSERT(instr->elements()->representation().IsExternal()); |
| 1922 |
| 1923 LOperand* external_pointer = UseRegister(instr->elements()); |
| 1924 result = new(zone()) LStoreKeyed(external_pointer, key, val); |
| 1908 } | 1925 } |
| 1909 #endif | |
| 1910 | 1926 |
| 1911 LStoreKeyed* result = new(zone()) LStoreKeyed(elements, key, val); | |
| 1912 ASSERT(result != NULL); | 1927 ASSERT(result != NULL); |
| 1913 return result; | 1928 return result; |
| 1914 } | 1929 } |
| 1915 | 1930 |
| 1916 | 1931 |
| 1917 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1932 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 1918 LOperand* object = UseFixed(instr->object(), rdx); | 1933 LOperand* object = UseFixed(instr->object(), rdx); |
| 1919 LOperand* key = UseFixed(instr->key(), rcx); | 1934 LOperand* key = UseFixed(instr->key(), rcx); |
| 1920 LOperand* value = UseFixed(instr->value(), rax); | 1935 LOperand* value = UseFixed(instr->value(), rax); |
| 1921 | 1936 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2259 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2245 LOperand* object = UseRegister(instr->object()); | 2260 LOperand* object = UseRegister(instr->object()); |
| 2246 LOperand* index = UseTempRegister(instr->index()); | 2261 LOperand* index = UseTempRegister(instr->index()); |
| 2247 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2262 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2248 } | 2263 } |
| 2249 | 2264 |
| 2250 | 2265 |
| 2251 } } // namespace v8::internal | 2266 } } // namespace v8::internal |
| 2252 | 2267 |
| 2253 #endif // V8_TARGET_ARCH_X64 | 2268 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |