Chromium Code Reviews
Help | Chromium Project | Sign in
(930)

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: Oops, removed a TODO Created 1 year, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
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(
1864 HLoadKeyedFastElement* instr) { 1855 HLoadKeyed* instr) {
danno 2012/10/29 14:56:13 nit: this can be on the line before
mvstanton 2012/10/29 15:23:57 Done.
1865 ASSERT(instr->representation().IsTagged());
1866 ASSERT(instr->key()->representation().IsInteger32() || 1856 ASSERT(instr->key()->representation().IsInteger32() ||
1867 instr->key()->representation().IsTagged()); 1857 instr->key()->representation().IsTagged());
1868 LOperand* obj = UseRegisterAtStart(instr->object()); 1858 ElementsKind elements_kind = instr->elements_kind();
1869 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 1859 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1870 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key); 1860 LLoadKeyed* result = NULL;
1871 if (instr->RequiresHoleCheck()) AssignEnvironment(result); 1861
1872 return DefineAsRegister(result); 1862 if (!instr->is_external()) {
1863 LOperand* obj = NULL;
1864 if (instr->representation().IsDouble()) {
1865 obj = UseTempRegister(instr->elements());
1866 } else {
1867 ASSERT(instr->representation().IsTagged());
1868 obj = UseRegisterAtStart(instr->elements());
1869 }
1870 result = new(zone()) LLoadKeyed(obj, key);
1871 } else {
1872 ASSERT(
1873 (instr->representation().IsInteger32() &&
1874 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1875 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1876 (instr->representation().IsDouble() &&
1877 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1878 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1879 LOperand* external_pointer = UseRegister(instr->elements());
1880 result = new(zone()) LLoadKeyed(external_pointer, key);
1881 }
1882
1883 DefineAsRegister(result);
1884 // An unsigned int array load might overflow and cause a deopt, make sure it
1885 // has an environment.
1886 bool can_deoptimize = instr->RequiresHoleCheck() ||
1887 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS);
1888 return can_deoptimize ? AssignEnvironment(result) : result;
1873 } 1889 }
1874 1890
1875 1891
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) { 1892 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1914 LOperand* object = UseFixed(instr->object(), r1); 1893 LOperand* object = UseFixed(instr->object(), r1);
1915 LOperand* key = UseFixed(instr->key(), r0); 1894 LOperand* key = UseFixed(instr->key(), r0);
1916 1895
1917 LInstruction* result = 1896 LInstruction* result =
1918 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); 1897 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0);
1919 return MarkAsCall(result, instr); 1898 return MarkAsCall(result, instr);
1920 } 1899 }
1921 1900
1922 1901
1923 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( 1902 LInstruction* LChunkBuilder::DoStoreKeyed(
1924 HStoreKeyedFastElement* instr) { 1903 HStoreKeyed* instr) {
danno 2012/10/29 14:56:13 nit: put on previous line
mvstanton 2012/10/29 15:23:57 Done.
1904 ElementsKind elements_kind = instr->elements_kind();
1925 bool needs_write_barrier = instr->NeedsWriteBarrier(); 1905 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 1906 LOperand* key = needs_write_barrier
1936 ? UseTempRegister(instr->key()) 1907 ? UseTempRegister(instr->key())
1937 : UseRegisterOrConstantAtStart(instr->key()); 1908 : UseRegisterOrConstantAtStart(instr->key());
1938 return new(zone()) LStoreKeyedFastElement(obj, key, val); 1909 bool val_is_temp_register =
1910 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
1911 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
1912 LOperand* val = val_is_temp_register || needs_write_barrier
1913 ? UseTempRegister(instr->value())
1914 : UseRegister(instr->value());
1915
1916 LStoreKeyed* result = NULL;
1917 if (!instr->is_external()) {
1918 ASSERT(instr->elements()->representation().IsTagged());
1919
1920 LOperand* object = NULL;
1921 if (instr->value()->representation().IsDouble()) {
1922 object = UseRegisterAtStart(instr->elements());
1923 } else {
1924 ASSERT(instr->value()->representation().IsTagged());
1925 object = UseTempRegister(instr->elements());
1926 }
1927
1928 result = new(zone()) LStoreKeyed(object, key, val);
1929 } else {
1930 ASSERT(
1931 (instr->value()->representation().IsInteger32() &&
1932 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1933 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1934 (instr->value()->representation().IsDouble() &&
1935 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1936 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1937 ASSERT(instr->elements()->representation().IsExternal());
1938
1939 LOperand* external_pointer = UseRegister(instr->elements());
1940 result = new(zone()) LStoreKeyed(external_pointer, key, val);
1941 }
1942
1943 ASSERT(result != NULL);
1944 return result;
1939 } 1945 }
1940 1946
1941 1947
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) { 1948 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
1987 LOperand* obj = UseFixed(instr->object(), r2); 1949 LOperand* obj = UseFixed(instr->object(), r2);
1988 LOperand* key = UseFixed(instr->key(), r1); 1950 LOperand* key = UseFixed(instr->key(), r1);
1989 LOperand* val = UseFixed(instr->value(), r0); 1951 LOperand* val = UseFixed(instr->value(), r0);
1990 1952
1991 ASSERT(instr->object()->representation().IsTagged()); 1953 ASSERT(instr->object()->representation().IsTagged());
1992 ASSERT(instr->key()->representation().IsTagged()); 1954 ASSERT(instr->key()->representation().IsTagged());
1993 ASSERT(instr->value()->representation().IsTagged()); 1955 ASSERT(instr->value()->representation().IsTagged());
1994 1956
1995 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr); 1957 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 2268
2307 2269
2308 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2270 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2309 LOperand* object = UseRegister(instr->object()); 2271 LOperand* object = UseRegister(instr->object());
2310 LOperand* index = UseRegister(instr->index()); 2272 LOperand* index = UseRegister(instr->index());
2311 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2273 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2312 } 2274 }
2313 2275
2314 2276
2315 } } // namespace v8::internal 2277 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1280:2d3e6564b7b6