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 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( | 1828 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( |
1829 HLoadExternalArrayPointer* instr) { | 1829 HLoadExternalArrayPointer* instr) { |
1830 LOperand* input = UseRegisterAtStart(instr->value()); | 1830 LOperand* input = UseRegisterAtStart(instr->value()); |
1831 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 1831 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
1832 } | 1832 } |
1833 | 1833 |
1834 | 1834 |
1835 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( | 1835 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
1836 HLoadKeyedFastElement* instr) { | 1836 HLoadKeyedFastElement* instr) { |
1837 ASSERT(instr->representation().IsTagged()); | 1837 ASSERT(instr->representation().IsTagged()); |
1838 ASSERT(instr->key()->representation().IsInteger32()); | 1838 ASSERT(instr->key()->representation().IsInteger32() || |
| 1839 instr->key()->representation().IsTagged()); |
1839 LOperand* obj = UseRegisterAtStart(instr->object()); | 1840 LOperand* obj = UseRegisterAtStart(instr->object()); |
1840 LOperand* key = UseRegisterAtStart(instr->key()); | 1841 LOperand* key = UseRegisterAtStart(instr->key()); |
1841 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key); | 1842 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key); |
1842 if (instr->RequiresHoleCheck()) AssignEnvironment(result); | 1843 if (instr->RequiresHoleCheck()) AssignEnvironment(result); |
1843 return DefineAsRegister(result); | 1844 return DefineAsRegister(result); |
1844 } | 1845 } |
1845 | 1846 |
1846 | 1847 |
1847 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( | 1848 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( |
1848 HLoadKeyedFastDoubleElement* instr) { | 1849 HLoadKeyedFastDoubleElement* instr) { |
1849 ASSERT(instr->representation().IsDouble()); | 1850 ASSERT(instr->representation().IsDouble()); |
1850 ASSERT(instr->key()->representation().IsInteger32()); | 1851 ASSERT(instr->key()->representation().IsInteger32() || |
| 1852 instr->key()->representation().IsTagged()); |
1851 LOperand* elements = UseTempRegister(instr->elements()); | 1853 LOperand* elements = UseTempRegister(instr->elements()); |
1852 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1854 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
1853 LLoadKeyedFastDoubleElement* result = | 1855 LLoadKeyedFastDoubleElement* result = |
1854 new(zone()) LLoadKeyedFastDoubleElement(elements, key); | 1856 new(zone()) LLoadKeyedFastDoubleElement(elements, key); |
1855 return AssignEnvironment(DefineAsRegister(result)); | 1857 return AssignEnvironment(DefineAsRegister(result)); |
1856 } | 1858 } |
1857 | 1859 |
1858 | 1860 |
1859 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1861 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
1860 HLoadKeyedSpecializedArrayElement* instr) { | 1862 HLoadKeyedSpecializedArrayElement* instr) { |
1861 ElementsKind elements_kind = instr->elements_kind(); | 1863 ElementsKind elements_kind = instr->elements_kind(); |
1862 ASSERT( | 1864 ASSERT( |
1863 (instr->representation().IsInteger32() && | 1865 (instr->representation().IsInteger32() && |
1864 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1866 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
1865 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1867 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
1866 (instr->representation().IsDouble() && | 1868 (instr->representation().IsDouble() && |
1867 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1869 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
1868 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1870 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
1869 ASSERT(instr->key()->representation().IsInteger32()); | 1871 ASSERT(instr->key()->representation().IsInteger32() || |
| 1872 instr->key()->representation().IsTagged()); |
1870 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1873 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1871 LOperand* key = UseRegisterOrConstant(instr->key()); | 1874 LOperand* key = UseRegisterOrConstant(instr->key()); |
1872 LLoadKeyedSpecializedArrayElement* result = | 1875 LLoadKeyedSpecializedArrayElement* result = |
1873 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, key); | 1876 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, key); |
1874 LInstruction* load_instr = DefineAsRegister(result); | 1877 LInstruction* load_instr = DefineAsRegister(result); |
1875 // An unsigned int array load might overflow and cause a deopt, make sure it | 1878 // An unsigned int array load might overflow and cause a deopt, make sure it |
1876 // has an environment. | 1879 // has an environment. |
1877 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ? | 1880 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ? |
1878 AssignEnvironment(load_instr) : load_instr; | 1881 AssignEnvironment(load_instr) : load_instr; |
1879 } | 1882 } |
1880 | 1883 |
1881 | 1884 |
1882 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1885 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
1883 LOperand* object = UseFixed(instr->object(), r1); | 1886 LOperand* object = UseFixed(instr->object(), r1); |
1884 LOperand* key = UseFixed(instr->key(), r0); | 1887 LOperand* key = UseFixed(instr->key(), r0); |
1885 | 1888 |
1886 LInstruction* result = | 1889 LInstruction* result = |
1887 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); | 1890 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); |
1888 return MarkAsCall(result, instr); | 1891 return MarkAsCall(result, instr); |
1889 } | 1892 } |
1890 | 1893 |
1891 | 1894 |
1892 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( | 1895 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( |
1893 HStoreKeyedFastElement* instr) { | 1896 HStoreKeyedFastElement* instr) { |
1894 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1897 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
1895 ASSERT(instr->value()->representation().IsTagged()); | 1898 ASSERT(instr->value()->representation().IsTagged()); |
1896 ASSERT(instr->object()->representation().IsTagged()); | 1899 ASSERT(instr->object()->representation().IsTagged()); |
1897 ASSERT(instr->key()->representation().IsInteger32()); | 1900 ASSERT(instr->key()->representation().IsInteger32() || |
| 1901 instr->key()->representation().IsTagged()); |
1898 | 1902 |
1899 LOperand* obj = UseTempRegister(instr->object()); | 1903 LOperand* obj = UseTempRegister(instr->object()); |
1900 LOperand* val = needs_write_barrier | 1904 LOperand* val = needs_write_barrier |
1901 ? UseTempRegister(instr->value()) | 1905 ? UseTempRegister(instr->value()) |
1902 : UseRegisterAtStart(instr->value()); | 1906 : UseRegisterAtStart(instr->value()); |
1903 LOperand* key = needs_write_barrier | 1907 LOperand* key = needs_write_barrier |
1904 ? UseTempRegister(instr->key()) | 1908 ? UseTempRegister(instr->key()) |
1905 : UseRegisterOrConstantAtStart(instr->key()); | 1909 : UseRegisterOrConstantAtStart(instr->key()); |
1906 return new(zone()) LStoreKeyedFastElement(obj, key, val); | 1910 return new(zone()) LStoreKeyedFastElement(obj, key, val); |
1907 } | 1911 } |
1908 | 1912 |
1909 | 1913 |
1910 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement( | 1914 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement( |
1911 HStoreKeyedFastDoubleElement* instr) { | 1915 HStoreKeyedFastDoubleElement* instr) { |
1912 ASSERT(instr->value()->representation().IsDouble()); | 1916 ASSERT(instr->value()->representation().IsDouble()); |
1913 ASSERT(instr->elements()->representation().IsTagged()); | 1917 ASSERT(instr->elements()->representation().IsTagged()); |
1914 ASSERT(instr->key()->representation().IsInteger32()); | 1918 ASSERT(instr->key()->representation().IsInteger32() || |
| 1919 instr->key()->representation().IsTagged()); |
1915 | 1920 |
1916 LOperand* elements = UseRegisterAtStart(instr->elements()); | 1921 LOperand* elements = UseRegisterAtStart(instr->elements()); |
1917 LOperand* val = UseTempRegister(instr->value()); | 1922 LOperand* val = UseTempRegister(instr->value()); |
1918 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1923 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
1919 | 1924 |
1920 return new(zone()) LStoreKeyedFastDoubleElement(elements, key, val); | 1925 return new(zone()) LStoreKeyedFastDoubleElement(elements, key, val); |
1921 } | 1926 } |
1922 | 1927 |
1923 | 1928 |
1924 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( | 1929 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
1925 HStoreKeyedSpecializedArrayElement* instr) { | 1930 HStoreKeyedSpecializedArrayElement* instr) { |
1926 ElementsKind elements_kind = instr->elements_kind(); | 1931 ElementsKind elements_kind = instr->elements_kind(); |
1927 ASSERT( | 1932 ASSERT( |
1928 (instr->value()->representation().IsInteger32() && | 1933 (instr->value()->representation().IsInteger32() && |
1929 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1934 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
1930 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1935 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
1931 (instr->value()->representation().IsDouble() && | 1936 (instr->value()->representation().IsDouble() && |
1932 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1937 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
1933 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1938 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
1934 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1939 ASSERT(instr->external_pointer()->representation().IsExternal()); |
1935 ASSERT(instr->key()->representation().IsInteger32()); | 1940 ASSERT(instr->key()->representation().IsInteger32() || |
| 1941 instr->key()->representation().IsTagged()); |
1936 | 1942 |
1937 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1943 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1938 bool val_is_temp_register = | 1944 bool val_is_temp_register = |
1939 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | 1945 elements_kind == EXTERNAL_PIXEL_ELEMENTS || |
1940 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | 1946 elements_kind == EXTERNAL_FLOAT_ELEMENTS; |
1941 LOperand* val = val_is_temp_register | 1947 LOperand* val = val_is_temp_register |
1942 ? UseTempRegister(instr->value()) | 1948 ? UseTempRegister(instr->value()) |
1943 : UseRegister(instr->value()); | 1949 : UseRegister(instr->value()); |
1944 LOperand* key = UseRegisterOrConstant(instr->key()); | 1950 LOperand* key = UseRegisterOrConstant(instr->key()); |
1945 | 1951 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 | 2280 |
2275 | 2281 |
2276 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2282 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2277 LOperand* object = UseRegister(instr->object()); | 2283 LOperand* object = UseRegister(instr->object()); |
2278 LOperand* index = UseRegister(instr->index()); | 2284 LOperand* index = UseRegister(instr->index()); |
2279 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2285 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2280 } | 2286 } |
2281 | 2287 |
2282 | 2288 |
2283 } } // namespace v8::internal | 2289 } } // namespace v8::internal |
OLD | NEW |