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

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: Fixed a compilation error in ia32 hydrogen->lithium. 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') | src/x64/lithium-codegen-x64.cc » ('J')
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 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 } 1868 }
1869 result = new(zone()) LLoadKeyed(obj, key); 1869 result = new(zone()) LLoadKeyed(obj, key);
1870 } else { 1870 } else {
1871 ASSERT( 1871 ASSERT(
1872 (instr->representation().IsInteger32() && 1872 (instr->representation().IsInteger32() &&
1873 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 1873 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1874 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 1874 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1875 (instr->representation().IsDouble() && 1875 (instr->representation().IsDouble() &&
1876 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 1876 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1877 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 1877 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1878 LOperand* external_pointer = UseRegister(instr->elements()); 1878
1879 LOperand* external_pointer;
1880 // We only need a long-lived register for constant keys with an offset
1881 if (instr->key()->IsConstant() && instr->index_offset() != 0) {
1882 external_pointer = UseRegister(instr->elements());
1883 } else {
1884 external_pointer = UseRegisterAtStart(instr->elements());
danno 2012/11/07 22:34:38 I don't see the difference in these two case in th
mvstanton 2012/11/09 09:43:13 Done.
1885 }
1886
1879 result = new(zone()) LLoadKeyed(external_pointer, key); 1887 result = new(zone()) LLoadKeyed(external_pointer, key);
1880 } 1888 }
1881 1889
1882 DefineAsRegister(result); 1890 DefineAsRegister(result);
1883 // An unsigned int array load might overflow and cause a deopt, make sure it 1891 // An unsigned int array load might overflow and cause a deopt, make sure it
1884 // has an environment. 1892 // has an environment.
1885 bool can_deoptimize = instr->RequiresHoleCheck() || 1893 bool can_deoptimize = instr->RequiresHoleCheck() ||
1886 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); 1894 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS);
1887 return can_deoptimize ? AssignEnvironment(result) : result; 1895 return can_deoptimize ? AssignEnvironment(result) : result;
1888 } 1896 }
1889 1897
1890 1898
1891 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 1899 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1892 LOperand* object = UseFixed(instr->object(), r1); 1900 LOperand* object = UseFixed(instr->object(), r1);
1893 LOperand* key = UseFixed(instr->key(), r0); 1901 LOperand* key = UseFixed(instr->key(), r0);
1894 1902
1895 LInstruction* result = 1903 LInstruction* result =
1896 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); 1904 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0);
1897 return MarkAsCall(result, instr); 1905 return MarkAsCall(result, instr);
1898 } 1906 }
1899 1907
1900 1908
1901 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { 1909 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
1902 ElementsKind elements_kind = instr->elements_kind(); 1910 LOperand* elements = UseRegisterAtStart(instr->elements());
1903 bool needs_write_barrier = instr->NeedsWriteBarrier(); 1911 LOperand* key;
1904 LOperand* key = needs_write_barrier 1912 LOperand* val;
1905 ? UseTempRegister(instr->key()) 1913 if (instr->NeedsWriteBarrier()) {
1906 : UseRegisterOrConstantAtStart(instr->key()); 1914 key = UseTempRegister(instr->key());
1907 bool val_is_temp_register = 1915 val = UseTempRegister(instr->value());
1908 elements_kind == EXTERNAL_PIXEL_ELEMENTS || 1916 } else {
1909 elements_kind == EXTERNAL_FLOAT_ELEMENTS; 1917 key = UseRegisterOrConstantAtStart(instr->key());
1910 LOperand* val = val_is_temp_register || needs_write_barrier 1918 val = UseRegisterAtStart(instr->value());
1911 ? UseTempRegister(instr->value()) 1919 }
1912 : UseRegister(instr->value());
1913 1920
1914 LStoreKeyed* result = NULL; 1921 #ifdef DEBUG
1915 if (!instr->is_external()) { 1922 if (!instr->is_external()) {
1916 ASSERT(instr->elements()->representation().IsTagged()); 1923 ASSERT(instr->elements()->representation().IsTagged());
1917
1918 LOperand* object = NULL;
1919 if (instr->value()->representation().IsDouble()) {
1920 object = UseRegisterAtStart(instr->elements());
1921 } else {
1922 ASSERT(instr->value()->representation().IsTagged());
1923 object = UseTempRegister(instr->elements());
1924 }
1925
1926 result = new(zone()) LStoreKeyed(object, key, val);
1927 } else { 1924 } else {
1925 ElementsKind elements_kind = instr->elements_kind();
1928 ASSERT( 1926 ASSERT(
1929 (instr->value()->representation().IsInteger32() && 1927 (instr->value()->representation().IsInteger32() &&
1930 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 1928 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1931 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 1929 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1932 (instr->value()->representation().IsDouble() && 1930 (instr->value()->representation().IsDouble() &&
1933 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 1931 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1934 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 1932 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1935 ASSERT(instr->elements()->representation().IsExternal()); 1933 ASSERT(instr->elements()->representation().IsExternal());
1934 }
1935 #endif
1936 1936
1937 LOperand* external_pointer = UseRegister(instr->elements()); 1937 LStoreKeyed* result = new(zone()) LStoreKeyed(elements, key, val);
1938 result = new(zone()) LStoreKeyed(external_pointer, key, val);
1939 }
1940
1941 ASSERT(result != NULL); 1938 ASSERT(result != NULL);
1942 return result; 1939 return result;
1943 } 1940 }
1944 1941
1945 1942
1946 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 1943 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
1947 LOperand* obj = UseFixed(instr->object(), r2); 1944 LOperand* obj = UseFixed(instr->object(), r2);
1948 LOperand* key = UseFixed(instr->key(), r1); 1945 LOperand* key = UseFixed(instr->key(), r1);
1949 LOperand* val = UseFixed(instr->value(), r0); 1946 LOperand* val = UseFixed(instr->value(), r0);
1950 1947
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 2263
2267 2264
2268 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2265 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2269 LOperand* object = UseRegister(instr->object()); 2266 LOperand* object = UseRegister(instr->object());
2270 LOperand* index = UseRegister(instr->index()); 2267 LOperand* index = UseRegister(instr->index());
2271 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2268 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2272 } 2269 }
2273 2270
2274 2271
2275 } } // namespace v8::internal 2272 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | src/x64/lithium-codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698