| 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 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 } | 1874 } |
| 1875 result = new(zone()) LLoadKeyed(obj, key); | 1875 result = new(zone()) LLoadKeyed(obj, key); |
| 1876 } else { | 1876 } else { |
| 1877 ASSERT( | 1877 ASSERT( |
| 1878 (instr->representation().IsInteger32() && | 1878 (instr->representation().IsInteger32() && |
| 1879 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1879 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1880 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1880 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1881 (instr->representation().IsDouble() && | 1881 (instr->representation().IsDouble() && |
| 1882 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1882 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1883 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1883 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1884 | |
| 1885 LOperand* external_pointer = UseRegister(instr->elements()); | 1884 LOperand* external_pointer = UseRegister(instr->elements()); |
| 1886 result = new(zone()) LLoadKeyed(external_pointer, key); | 1885 result = new(zone()) LLoadKeyed(external_pointer, key); |
| 1887 } | 1886 } |
| 1888 | 1887 |
| 1889 DefineAsRegister(result); | 1888 DefineAsRegister(result); |
| 1890 // An unsigned int array load might overflow and cause a deopt, make sure it | 1889 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1891 // has an environment. | 1890 // has an environment. |
| 1892 bool can_deoptimize = instr->RequiresHoleCheck() || | 1891 bool can_deoptimize = instr->RequiresHoleCheck() || |
| 1893 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 1892 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); |
| 1894 return can_deoptimize ? AssignEnvironment(result) : result; | 1893 return can_deoptimize ? AssignEnvironment(result) : result; |
| 1895 } | 1894 } |
| 1896 | 1895 |
| 1897 | 1896 |
| 1898 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1897 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1899 LOperand* object = UseFixed(instr->object(), r1); | 1898 LOperand* object = UseFixed(instr->object(), r1); |
| 1900 LOperand* key = UseFixed(instr->key(), r0); | 1899 LOperand* key = UseFixed(instr->key(), r0); |
| 1901 | 1900 |
| 1902 LInstruction* result = | 1901 LInstruction* result = |
| 1903 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); | 1902 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); |
| 1904 return MarkAsCall(result, instr); | 1903 return MarkAsCall(result, instr); |
| 1905 } | 1904 } |
| 1906 | 1905 |
| 1907 | 1906 |
| 1908 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 1907 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 1909 LOperand* elements = UseRegisterAtStart(instr->elements()); | 1908 ElementsKind elements_kind = instr->elements_kind(); |
| 1910 LOperand* key; | 1909 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 1911 LOperand* val; | 1910 LOperand* key = needs_write_barrier |
| 1912 if (instr->NeedsWriteBarrier()) { | 1911 ? UseTempRegister(instr->key()) |
| 1913 key = UseTempRegister(instr->key()); | 1912 : UseRegisterOrConstantAtStart(instr->key()); |
| 1914 val = UseTempRegister(instr->value()); | 1913 bool val_is_temp_register = |
| 1915 } else { | 1914 elements_kind == EXTERNAL_PIXEL_ELEMENTS || |
| 1916 key = UseRegisterOrConstantAtStart(instr->key()); | 1915 elements_kind == EXTERNAL_FLOAT_ELEMENTS; |
| 1917 val = UseRegisterAtStart(instr->value()); | 1916 LOperand* val = val_is_temp_register || needs_write_barrier |
| 1918 } | 1917 ? UseTempRegister(instr->value()) |
| 1918 : UseRegister(instr->value()); |
| 1919 | 1919 |
| 1920 #ifdef DEBUG | 1920 LStoreKeyed* result = NULL; |
| 1921 if (!instr->is_external()) { | 1921 if (!instr->is_external()) { |
| 1922 ASSERT(instr->elements()->representation().IsTagged()); | 1922 ASSERT(instr->elements()->representation().IsTagged()); |
| 1923 |
| 1924 LOperand* object = NULL; |
| 1925 if (instr->value()->representation().IsDouble()) { |
| 1926 object = UseRegisterAtStart(instr->elements()); |
| 1927 } else { |
| 1928 ASSERT(instr->value()->representation().IsTagged()); |
| 1929 object = UseTempRegister(instr->elements()); |
| 1930 } |
| 1931 |
| 1932 result = new(zone()) LStoreKeyed(object, key, val); |
| 1923 } else { | 1933 } else { |
| 1924 ElementsKind elements_kind = instr->elements_kind(); | |
| 1925 ASSERT( | 1934 ASSERT( |
| 1926 (instr->value()->representation().IsInteger32() && | 1935 (instr->value()->representation().IsInteger32() && |
| 1927 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1936 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1928 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1937 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1929 (instr->value()->representation().IsDouble() && | 1938 (instr->value()->representation().IsDouble() && |
| 1930 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1939 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1931 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1940 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1932 ASSERT(instr->elements()->representation().IsExternal()); | 1941 ASSERT(instr->elements()->representation().IsExternal()); |
| 1942 |
| 1943 LOperand* external_pointer = UseRegister(instr->elements()); |
| 1944 result = new(zone()) LStoreKeyed(external_pointer, key, val); |
| 1933 } | 1945 } |
| 1934 #endif | |
| 1935 | 1946 |
| 1936 LStoreKeyed* result = new(zone()) LStoreKeyed(elements, key, val); | |
| 1937 ASSERT(result != NULL); | 1947 ASSERT(result != NULL); |
| 1938 return result; | 1948 return result; |
| 1939 } | 1949 } |
| 1940 | 1950 |
| 1941 | 1951 |
| 1942 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1952 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 1943 LOperand* obj = UseFixed(instr->object(), r2); | 1953 LOperand* obj = UseFixed(instr->object(), r2); |
| 1944 LOperand* key = UseFixed(instr->key(), r1); | 1954 LOperand* key = UseFixed(instr->key(), r1); |
| 1945 LOperand* val = UseFixed(instr->value(), r0); | 1955 LOperand* val = UseFixed(instr->value(), r0); |
| 1946 | 1956 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2262 | 2272 |
| 2263 | 2273 |
| 2264 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2274 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2265 LOperand* object = UseRegister(instr->object()); | 2275 LOperand* object = UseRegister(instr->object()); |
| 2266 LOperand* index = UseRegister(instr->index()); | 2276 LOperand* index = UseRegister(instr->index()); |
| 2267 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2277 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2268 } | 2278 } |
| 2269 | 2279 |
| 2270 | 2280 |
| 2271 } } // namespace v8::internal | 2281 } } // namespace v8::internal |
| OLD | NEW |