Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: src/arm/lithium-arm.cc

Issue 11365084: Some improvements in register usage in lithium compilation of LoadKeyed/StoreKeyed operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Response to comments, thx! Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
1884 LOperand* external_pointer = UseRegister(instr->elements()); 1885 LOperand* external_pointer = UseRegister(instr->elements());
1885 result = new(zone()) LLoadKeyed(external_pointer, key); 1886 result = new(zone()) LLoadKeyed(external_pointer, key);
1886 } 1887 }
1887 1888
1888 DefineAsRegister(result); 1889 DefineAsRegister(result);
1889 // An unsigned int array load might overflow and cause a deopt, make sure it 1890 // An unsigned int array load might overflow and cause a deopt, make sure it
1890 // has an environment. 1891 // has an environment.
1891 bool can_deoptimize = instr->RequiresHoleCheck() || 1892 bool can_deoptimize = instr->RequiresHoleCheck() ||
1892 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); 1893 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS);
1893 return can_deoptimize ? AssignEnvironment(result) : result; 1894 return can_deoptimize ? AssignEnvironment(result) : result;
1894 } 1895 }
1895 1896
1896 1897
1897 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 1898 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1898 LOperand* object = UseFixed(instr->object(), r1); 1899 LOperand* object = UseFixed(instr->object(), r1);
1899 LOperand* key = UseFixed(instr->key(), r0); 1900 LOperand* key = UseFixed(instr->key(), r0);
1900 1901
1901 LInstruction* result = 1902 LInstruction* result =
1902 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); 1903 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0);
1903 return MarkAsCall(result, instr); 1904 return MarkAsCall(result, instr);
1904 } 1905 }
1905 1906
1906 1907
1907 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { 1908 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
1908 ElementsKind elements_kind = instr->elements_kind(); 1909 LOperand* elements = UseRegisterAtStart(instr->elements());
1909 bool needs_write_barrier = instr->NeedsWriteBarrier(); 1910 LOperand* key;
1910 LOperand* key = needs_write_barrier 1911 LOperand* val;
1911 ? UseTempRegister(instr->key()) 1912 if (instr->NeedsWriteBarrier()) {
1912 : UseRegisterOrConstantAtStart(instr->key()); 1913 key = UseTempRegister(instr->key());
1913 bool val_is_temp_register = 1914 val = UseTempRegister(instr->value());
1914 elements_kind == EXTERNAL_PIXEL_ELEMENTS || 1915 } else {
1915 elements_kind == EXTERNAL_FLOAT_ELEMENTS; 1916 key = UseRegisterOrConstantAtStart(instr->key());
1916 LOperand* val = val_is_temp_register || needs_write_barrier 1917 val = UseRegisterAtStart(instr->value());
1917 ? UseTempRegister(instr->value()) 1918 }
1918 : UseRegister(instr->value());
1919 1919
1920 LStoreKeyed* result = NULL; 1920 #ifdef DEBUG
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);
1933 } else { 1923 } else {
1924 ElementsKind elements_kind = instr->elements_kind();
1934 ASSERT( 1925 ASSERT(
1935 (instr->value()->representation().IsInteger32() && 1926 (instr->value()->representation().IsInteger32() &&
1936 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 1927 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1937 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 1928 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1938 (instr->value()->representation().IsDouble() && 1929 (instr->value()->representation().IsDouble() &&
1939 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 1930 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1940 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 1931 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1941 ASSERT(instr->elements()->representation().IsExternal()); 1932 ASSERT(instr->elements()->representation().IsExternal());
1933 }
1934 #endif
1942 1935
1943 LOperand* external_pointer = UseRegister(instr->elements()); 1936 LStoreKeyed* result = new(zone()) LStoreKeyed(elements, key, val);
1944 result = new(zone()) LStoreKeyed(external_pointer, key, val);
1945 }
1946
1947 ASSERT(result != NULL); 1937 ASSERT(result != NULL);
1948 return result; 1938 return result;
1949 } 1939 }
1950 1940
1951 1941
1952 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 1942 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
1953 LOperand* obj = UseFixed(instr->object(), r2); 1943 LOperand* obj = UseFixed(instr->object(), r2);
1954 LOperand* key = UseFixed(instr->key(), r1); 1944 LOperand* key = UseFixed(instr->key(), r1);
1955 LOperand* val = UseFixed(instr->value(), r0); 1945 LOperand* val = UseFixed(instr->value(), r0);
1956 1946
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 2262
2273 2263
2274 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2264 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2275 LOperand* object = UseRegister(instr->object()); 2265 LOperand* object = UseRegister(instr->object());
2276 LOperand* index = UseRegister(instr->index()); 2266 LOperand* index = UseRegister(instr->index());
2277 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2267 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2278 } 2268 }
2279 2269
2280 2270
2281 } } // namespace v8::internal 2271 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698