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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 | 1880 |
1881 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); | 1881 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); |
1882 return MarkAsCall(DefineFixed(result, rax), instr); | 1882 return MarkAsCall(DefineFixed(result, rax), instr); |
1883 } | 1883 } |
1884 | 1884 |
1885 | 1885 |
1886 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 1886 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
1887 ElementsKind elements_kind = instr->elements_kind(); | 1887 ElementsKind elements_kind = instr->elements_kind(); |
1888 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1888 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
1889 bool clobbers_key = instr->key()->representation().IsTagged(); | 1889 bool clobbers_key = instr->key()->representation().IsTagged(); |
1890 LOperand* key = (clobbers_key || needs_write_barrier) | |
1891 ? UseTempRegister(instr->key()) | |
1892 : UseRegisterOrConstantAtStart(instr->key()); | |
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) | |
1897 ? UseTempRegister(instr->value()) | |
1898 : UseRegisterAtStart(instr->value()); | |
1899 LStoreKeyed* result = NULL; | 1890 LStoreKeyed* result = NULL; |
1900 | 1891 |
1901 if (!instr->is_external()) { | 1892 if (!instr->is_external()) { |
1902 ASSERT(instr->elements()->representation().IsTagged()); | 1893 ASSERT(instr->elements()->representation().IsTagged()); |
1903 | 1894 |
1904 LOperand* object = NULL; | 1895 LOperand* object = NULL; |
| 1896 LOperand* key = NULL; |
| 1897 LOperand* val = NULL; |
1905 if (instr->value()->representation().IsDouble()) { | 1898 if (instr->value()->representation().IsDouble()) { |
1906 object = UseRegisterAtStart(instr->elements()); | 1899 object = UseRegisterAtStart(instr->elements()); |
| 1900 val = UseTempRegister(instr->value()); |
| 1901 key = clobbers_key ? UseTempRegister(instr->key()) |
| 1902 : UseRegisterOrConstantAtStart(instr->key()); |
1907 } else { | 1903 } else { |
1908 ASSERT(instr->value()->representation().IsTagged()); | 1904 ASSERT(instr->value()->representation().IsTagged()); |
1909 object = UseTempRegister(instr->elements()); | 1905 object = UseTempRegister(instr->elements()); |
| 1906 val = needs_write_barrier ? UseTempRegister(instr->value()) |
| 1907 : UseRegisterAtStart(instr->value()); |
| 1908 key = (clobbers_key || needs_write_barrier) |
| 1909 ? UseTempRegister(instr->key()) |
| 1910 : UseRegisterOrConstantAtStart(instr->key()); |
1910 } | 1911 } |
1911 | 1912 |
1912 result = new(zone()) LStoreKeyed(object, key, val); | 1913 result = new(zone()) LStoreKeyed(object, key, val); |
1913 } else { | 1914 } else { |
1914 ASSERT( | 1915 ASSERT( |
1915 (instr->value()->representation().IsInteger32() && | 1916 (instr->value()->representation().IsInteger32() && |
1916 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1917 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
1917 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1918 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
1918 (instr->value()->representation().IsDouble() && | 1919 (instr->value()->representation().IsDouble() && |
1919 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1920 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
1920 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1921 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
1921 ASSERT(instr->elements()->representation().IsExternal()); | 1922 ASSERT(instr->elements()->representation().IsExternal()); |
1922 | 1923 bool val_is_temp_register = |
| 1924 elements_kind == EXTERNAL_PIXEL_ELEMENTS || |
| 1925 elements_kind == EXTERNAL_FLOAT_ELEMENTS; |
| 1926 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) |
| 1927 : UseRegister(instr->value()); |
| 1928 LOperand* key = clobbers_key ? UseTempRegister(instr->key()) |
| 1929 : UseRegisterOrConstantAtStart(instr->key()); |
1923 LOperand* external_pointer = UseRegister(instr->elements()); | 1930 LOperand* external_pointer = UseRegister(instr->elements()); |
1924 result = new(zone()) LStoreKeyed(external_pointer, key, val); | 1931 result = new(zone()) LStoreKeyed(external_pointer, key, val); |
1925 } | 1932 } |
1926 | 1933 |
1927 ASSERT(result != NULL); | 1934 ASSERT(result != NULL); |
1928 return result; | 1935 return result; |
1929 } | 1936 } |
1930 | 1937 |
1931 | 1938 |
1932 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1939 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2266 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2260 LOperand* object = UseRegister(instr->object()); | 2267 LOperand* object = UseRegister(instr->object()); |
2261 LOperand* index = UseTempRegister(instr->index()); | 2268 LOperand* index = UseTempRegister(instr->index()); |
2262 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2269 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2263 } | 2270 } |
2264 | 2271 |
2265 | 2272 |
2266 } } // namespace v8::internal | 2273 } } // namespace v8::internal |
2267 | 2274 |
2268 #endif // V8_TARGET_ARCH_X64 | 2275 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |