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

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

Issue 11238016: Consolidated all the key store/load classes in the Hydrogen and Lithium (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Last batch of comment response, formatting issues. 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 | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 365
366 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) { 366 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
367 object()->PrintTo(stream); 367 object()->PrintTo(stream);
368 stream->Add("."); 368 stream->Add(".");
369 stream->Add(*String::cast(*name())->ToCString()); 369 stream->Add(*String::cast(*name())->ToCString());
370 stream->Add(" <- "); 370 stream->Add(" <- ");
371 value()->PrintTo(stream); 371 value()->PrintTo(stream);
372 } 372 }
373 373
374 374
375 void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) { 375 void LStoreKeyed::PrintDataTo(StringStream* stream) {
376 object()->PrintTo(stream);
377 stream->Add("[");
378 key()->PrintTo(stream);
379 stream->Add("] <- ");
380 value()->PrintTo(stream);
381 }
382
383
384 void LStoreKeyedFastDoubleElement::PrintDataTo(StringStream* stream) {
385 elements()->PrintTo(stream); 376 elements()->PrintTo(stream);
386 stream->Add("["); 377 stream->Add("[");
387 key()->PrintTo(stream); 378 key()->PrintTo(stream);
388 stream->Add("] <- "); 379 stream->Add("] <- ");
389 value()->PrintTo(stream); 380 value()->PrintTo(stream);
390 } 381 }
391 382
392 383
393 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { 384 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
394 object()->PrintTo(stream); 385 object()->PrintTo(stream);
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 } 1844 }
1854 1845
1855 1846
1856 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( 1847 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
1857 HLoadExternalArrayPointer* instr) { 1848 HLoadExternalArrayPointer* instr) {
1858 LOperand* input = UseRegisterAtStart(instr->value()); 1849 LOperand* input = UseRegisterAtStart(instr->value());
1859 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); 1850 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input));
1860 } 1851 }
1861 1852
1862 1853
1863 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( 1854 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
1864 HLoadKeyedFastElement* instr) {
1865 ASSERT(instr->representation().IsTagged());
1866 ASSERT(instr->key()->representation().IsInteger32() || 1855 ASSERT(instr->key()->representation().IsInteger32() ||
1867 instr->key()->representation().IsTagged()); 1856 instr->key()->representation().IsTagged());
1868 LOperand* obj = UseRegisterAtStart(instr->object()); 1857 ElementsKind elements_kind = instr->elements_kind();
1869 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 1858 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1870 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key); 1859 LLoadKeyed* result = NULL;
1871 if (instr->RequiresHoleCheck()) AssignEnvironment(result); 1860
1872 return DefineAsRegister(result); 1861 if (!instr->is_external()) {
1862 LOperand* obj = NULL;
1863 if (instr->representation().IsDouble()) {
1864 obj = UseTempRegister(instr->elements());
1865 } else {
1866 ASSERT(instr->representation().IsTagged());
1867 obj = UseRegisterAtStart(instr->elements());
1868 }
1869 result = new(zone()) LLoadKeyed(obj, key);
1870 } else {
1871 ASSERT(
1872 (instr->representation().IsInteger32() &&
1873 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1874 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1875 (instr->representation().IsDouble() &&
1876 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1877 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1878 LOperand* external_pointer = UseRegister(instr->elements());
1879 result = new(zone()) LLoadKeyed(external_pointer, key);
1880 }
1881
1882 DefineAsRegister(result);
1883 // An unsigned int array load might overflow and cause a deopt, make sure it
1884 // has an environment.
1885 bool can_deoptimize = instr->RequiresHoleCheck() ||
1886 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS);
1887 return can_deoptimize ? AssignEnvironment(result) : result;
1873 } 1888 }
1874 1889
1875 1890
1876 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement(
1877 HLoadKeyedFastDoubleElement* instr) {
1878 ASSERT(instr->representation().IsDouble());
1879 ASSERT(instr->key()->representation().IsInteger32() ||
1880 instr->key()->representation().IsTagged());
1881 LOperand* elements = UseTempRegister(instr->elements());
1882 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1883 LLoadKeyedFastDoubleElement* result =
1884 new(zone()) LLoadKeyedFastDoubleElement(elements, key);
1885 return AssignEnvironment(DefineAsRegister(result));
1886 }
1887
1888
1889 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement(
1890 HLoadKeyedSpecializedArrayElement* instr) {
1891 ElementsKind elements_kind = instr->elements_kind();
1892 ASSERT(
1893 (instr->representation().IsInteger32() &&
1894 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1895 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1896 (instr->representation().IsDouble() &&
1897 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1898 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1899 ASSERT(instr->key()->representation().IsInteger32() ||
1900 instr->key()->representation().IsTagged());
1901 LOperand* external_pointer = UseRegister(instr->external_pointer());
1902 LOperand* key = UseRegisterOrConstant(instr->key());
1903 LLoadKeyedSpecializedArrayElement* result =
1904 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, key);
1905 LInstruction* load_instr = DefineAsRegister(result);
1906 // An unsigned int array load might overflow and cause a deopt, make sure it
1907 // has an environment.
1908 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ?
1909 AssignEnvironment(load_instr) : load_instr;
1910 }
1911
1912
1913 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 1891 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1914 LOperand* object = UseFixed(instr->object(), r1); 1892 LOperand* object = UseFixed(instr->object(), r1);
1915 LOperand* key = UseFixed(instr->key(), r0); 1893 LOperand* key = UseFixed(instr->key(), r0);
1916 1894
1917 LInstruction* result = 1895 LInstruction* result =
1918 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); 1896 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0);
1919 return MarkAsCall(result, instr); 1897 return MarkAsCall(result, instr);
1920 } 1898 }
1921 1899
1922 1900
1923 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( 1901 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
1924 HStoreKeyedFastElement* instr) { 1902 ElementsKind elements_kind = instr->elements_kind();
1925 bool needs_write_barrier = instr->NeedsWriteBarrier(); 1903 bool needs_write_barrier = instr->NeedsWriteBarrier();
1926 ASSERT(instr->value()->representation().IsTagged());
1927 ASSERT(instr->object()->representation().IsTagged());
1928 ASSERT(instr->key()->representation().IsInteger32() ||
1929 instr->key()->representation().IsTagged());
1930
1931 LOperand* obj = UseTempRegister(instr->object());
1932 LOperand* val = needs_write_barrier
1933 ? UseTempRegister(instr->value())
1934 : UseRegisterAtStart(instr->value());
1935 LOperand* key = needs_write_barrier 1904 LOperand* key = needs_write_barrier
1936 ? UseTempRegister(instr->key()) 1905 ? UseTempRegister(instr->key())
1937 : UseRegisterOrConstantAtStart(instr->key()); 1906 : UseRegisterOrConstantAtStart(instr->key());
1938 return new(zone()) LStoreKeyedFastElement(obj, key, val); 1907 bool val_is_temp_register =
1908 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
1909 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
1910 LOperand* val = val_is_temp_register || needs_write_barrier
1911 ? UseTempRegister(instr->value())
1912 : UseRegister(instr->value());
1913
1914 LStoreKeyed* result = NULL;
1915 if (!instr->is_external()) {
1916 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 {
1928 ASSERT(
1929 (instr->value()->representation().IsInteger32() &&
1930 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1931 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1932 (instr->value()->representation().IsDouble() &&
1933 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1934 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1935 ASSERT(instr->elements()->representation().IsExternal());
1936
1937 LOperand* external_pointer = UseRegister(instr->elements());
1938 result = new(zone()) LStoreKeyed(external_pointer, key, val);
1939 }
1940
1941 ASSERT(result != NULL);
1942 return result;
1939 } 1943 }
1940 1944
1941 1945
1942 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement(
1943 HStoreKeyedFastDoubleElement* instr) {
1944 ASSERT(instr->value()->representation().IsDouble());
1945 ASSERT(instr->elements()->representation().IsTagged());
1946 ASSERT(instr->key()->representation().IsInteger32() ||
1947 instr->key()->representation().IsTagged());
1948
1949 LOperand* elements = UseRegisterAtStart(instr->elements());
1950 LOperand* val = UseTempRegister(instr->value());
1951 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1952
1953 return new(zone()) LStoreKeyedFastDoubleElement(elements, key, val);
1954 }
1955
1956
1957 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement(
1958 HStoreKeyedSpecializedArrayElement* instr) {
1959 ElementsKind elements_kind = instr->elements_kind();
1960 ASSERT(
1961 (instr->value()->representation().IsInteger32() &&
1962 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1963 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1964 (instr->value()->representation().IsDouble() &&
1965 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1966 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1967 ASSERT(instr->external_pointer()->representation().IsExternal());
1968 ASSERT(instr->key()->representation().IsInteger32() ||
1969 instr->key()->representation().IsTagged());
1970
1971 LOperand* external_pointer = UseRegister(instr->external_pointer());
1972 bool val_is_temp_register =
1973 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
1974 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
1975 LOperand* val = val_is_temp_register
1976 ? UseTempRegister(instr->value())
1977 : UseRegister(instr->value());
1978 LOperand* key = UseRegisterOrConstant(instr->key());
1979
1980 return new(zone()) LStoreKeyedSpecializedArrayElement(external_pointer,
1981 key,
1982 val);
1983 }
1984
1985
1986 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 1946 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
1987 LOperand* obj = UseFixed(instr->object(), r2); 1947 LOperand* obj = UseFixed(instr->object(), r2);
1988 LOperand* key = UseFixed(instr->key(), r1); 1948 LOperand* key = UseFixed(instr->key(), r1);
1989 LOperand* val = UseFixed(instr->value(), r0); 1949 LOperand* val = UseFixed(instr->value(), r0);
1990 1950
1991 ASSERT(instr->object()->representation().IsTagged()); 1951 ASSERT(instr->object()->representation().IsTagged());
1992 ASSERT(instr->key()->representation().IsTagged()); 1952 ASSERT(instr->key()->representation().IsTagged());
1993 ASSERT(instr->value()->representation().IsTagged()); 1953 ASSERT(instr->value()->representation().IsTagged());
1994 1954
1995 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr); 1955 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 2266
2307 2267
2308 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2268 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2309 LOperand* object = UseRegister(instr->object()); 2269 LOperand* object = UseRegister(instr->object());
2310 LOperand* index = UseRegister(instr->index()); 2270 LOperand* index = UseRegister(instr->index());
2311 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2271 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2312 } 2272 }
2313 2273
2314 2274
2315 } } // namespace v8::internal 2275 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698