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