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

Side by Side Diff: src/x64/lithium-x64.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: Fixed the 2 failing mjsunit tests Created 8 years, 2 months 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
« src/hydrogen-instructions.cc ('K') | « src/x64/lithium-x64.h ('k') | no next file » | 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) { 388 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
389 object()->PrintTo(stream); 389 object()->PrintTo(stream);
390 stream->Add("."); 390 stream->Add(".");
391 stream->Add(*String::cast(*name())->ToCString()); 391 stream->Add(*String::cast(*name())->ToCString());
392 stream->Add(" <- "); 392 stream->Add(" <- ");
393 value()->PrintTo(stream); 393 value()->PrintTo(stream);
394 } 394 }
395 395
396 396
397 void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) { 397 void LStoreKeyed::PrintDataTo(StringStream* stream) {
398 object()->PrintTo(stream); 398 object()->PrintTo(stream);
399 stream->Add("["); 399 stream->Add("[");
400 key()->PrintTo(stream); 400 key()->PrintTo(stream);
401 stream->Add("] <- "); 401 stream->Add("] <- ");
402 value()->PrintTo(stream); 402 value()->PrintTo(stream);
403 } 403 }
404 404
405 405
406 void LStoreKeyedFastDoubleElement::PrintDataTo(StringStream* stream) {
407 elements()->PrintTo(stream);
408 stream->Add("[");
409 key()->PrintTo(stream);
410 stream->Add("] <- ");
411 value()->PrintTo(stream);
412 }
413
414
415 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { 406 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
416 object()->PrintTo(stream); 407 object()->PrintTo(stream);
417 stream->Add("["); 408 stream->Add("[");
418 key()->PrintTo(stream); 409 key()->PrintTo(stream);
419 stream->Add("] <- "); 410 stream->Add("] <- ");
420 value()->PrintTo(stream); 411 value()->PrintTo(stream);
421 } 412 }
422 413
423 414
424 void LTransitionElementsKind::PrintDataTo(StringStream* stream) { 415 void LTransitionElementsKind::PrintDataTo(StringStream* stream) {
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 } 1827 }
1837 1828
1838 1829
1839 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( 1830 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
1840 HLoadExternalArrayPointer* instr) { 1831 HLoadExternalArrayPointer* instr) {
1841 LOperand* input = UseRegisterAtStart(instr->value()); 1832 LOperand* input = UseRegisterAtStart(instr->value());
1842 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); 1833 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input));
1843 } 1834 }
1844 1835
1845 1836
1846 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( 1837 LInstruction* LChunkBuilder::DoLoadKeyed(
1847 HLoadKeyedFastElement* instr) { 1838 HLoadKeyed* instr) {
1848 ASSERT(instr->representation().IsTagged());
1849 ASSERT(instr->key()->representation().IsInteger32() || 1839 ASSERT(instr->key()->representation().IsInteger32() ||
1850 instr->key()->representation().IsTagged()); 1840 instr->key()->representation().IsTagged());
1851 LOperand* obj = UseRegisterAtStart(instr->object());
1852 bool clobbers_key = instr->key()->representation().IsTagged();
1853 LOperand* key = clobbers_key
1854 ? UseTempRegister(instr->key())
1855 : UseRegisterOrConstantAtStart(instr->key());
1856 LLoadKeyedFastElement* result =
1857 new(zone()) LLoadKeyedFastElement(obj, key);
1858 if (instr->RequiresHoleCheck()) AssignEnvironment(result);
1859 return DefineAsRegister(result);
1860 }
1861 1841
1842 if (!instr->is_external()) {
1843 LOperand* obj = UseRegisterAtStart(instr->object());
1844 bool clobbers_key = instr->key()->representation().IsTagged();
1845 LOperand* key = clobbers_key
1846 ? UseTempRegister(instr->key())
1847 : UseRegisterOrConstantAtStart(instr->key());
1862 1848
1863 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( 1849 LLoadKeyed* result = new(zone()) LLoadKeyed(obj, key);
1864 HLoadKeyedFastDoubleElement* instr) { 1850 // TODO(mvstanton): environment not assigned for packed double, but
1865 ASSERT(instr->representation().IsDouble()); 1851 // it used to be. Fix?
1866 ASSERT(instr->key()->representation().IsInteger32() || 1852 if (instr->RequiresHoleCheck()) AssignEnvironment(result);
1867 instr->key()->representation().IsTagged()); 1853 return DefineAsRegister(result);
1868 LOperand* elements = UseRegisterAtStart(instr->elements()); 1854 }
1869 bool clobbers_key = instr->key()->representation().IsTagged();
1870 LOperand* key = clobbers_key
1871 ? UseTempRegister(instr->key())
1872 : UseRegisterOrConstantAtStart(instr->key());
1873 LLoadKeyedFastDoubleElement* result =
1874 new(zone()) LLoadKeyedFastDoubleElement(elements, key);
1875 return AssignEnvironment(DefineAsRegister(result));
1876 }
1877 1855
1878
1879 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement(
1880 HLoadKeyedSpecializedArrayElement* instr) {
1881 ElementsKind elements_kind = instr->elements_kind(); 1856 ElementsKind elements_kind = instr->elements_kind();
1882 ASSERT( 1857 ASSERT(
1883 (instr->representation().IsInteger32() && 1858 (instr->representation().IsInteger32() &&
1884 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 1859 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1885 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 1860 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1886 (instr->representation().IsDouble() && 1861 (instr->representation().IsDouble() &&
1887 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 1862 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1888 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 1863 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1889 ASSERT(instr->key()->representation().IsInteger32() ||
1890 instr->key()->representation().IsTagged());
1891 LOperand* external_pointer = UseRegister(instr->external_pointer()); 1864 LOperand* external_pointer = UseRegister(instr->external_pointer());
1892 bool clobbers_key = instr->key()->representation().IsTagged(); 1865 bool clobbers_key = instr->key()->representation().IsTagged();
1893 LOperand* key = clobbers_key 1866 LOperand* key = clobbers_key
1894 ? UseTempRegister(instr->key()) 1867 ? UseTempRegister(instr->key())
1895 : UseRegisterOrConstantAtStart(instr->key()); 1868 : UseRegisterOrConstantAtStart(instr->key());
1896 LLoadKeyedSpecializedArrayElement* result = 1869 LLoadKeyed* result = new(zone()) LLoadKeyed(external_pointer, key);
1897 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, key);
1898 LInstruction* load_instr = DefineAsRegister(result);
1899 // An unsigned int array load might overflow and cause a deopt, make sure it 1870 // An unsigned int array load might overflow and cause a deopt, make sure it
1900 // has an environment. 1871 // has an environment.
1901 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ? 1872 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ?
1902 AssignEnvironment(load_instr) : load_instr; 1873 AssignEnvironment(result) : result;
1903 } 1874 }
1904 1875
1905 1876
1906 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 1877 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1907 LOperand* object = UseFixed(instr->object(), rdx); 1878 LOperand* object = UseFixed(instr->object(), rdx);
1908 LOperand* key = UseFixed(instr->key(), rax); 1879 LOperand* key = UseFixed(instr->key(), rax);
1909 1880
1910 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); 1881 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key);
1911 return MarkAsCall(DefineFixed(result, rax), instr); 1882 return MarkAsCall(DefineFixed(result, rax), instr);
1912 } 1883 }
1913 1884
1914 1885
1915 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( 1886 LInstruction* LChunkBuilder::DoStoreKeyed(
1916 HStoreKeyedFastElement* instr) { 1887 HStoreKeyed* instr) {
1917 bool needs_write_barrier = instr->NeedsWriteBarrier();
1918 ASSERT(instr->value()->representation().IsTagged());
1919 ASSERT(instr->object()->representation().IsTagged());
1920 ASSERT(instr->key()->representation().IsInteger32() || 1888 ASSERT(instr->key()->representation().IsInteger32() ||
1921 instr->key()->representation().IsTagged()); 1889 instr->key()->representation().IsTagged());
1922 1890
1923 LOperand* obj = UseTempRegister(instr->object()); 1891 if (!instr->is_external()) {
1924 LOperand* val = needs_write_barrier 1892 ASSERT(instr->object()->representation().IsTagged());
1925 ? UseTempRegister(instr->value()) 1893
1926 : UseRegisterAtStart(instr->value()); 1894 if (instr->value()->representation().IsDouble()) {
1927 bool clobbers_key = needs_write_barrier || 1895 LOperand* object = UseRegisterAtStart(instr->object());
1928 instr->key()->representation().IsTagged(); 1896 LOperand* val = UseTempRegister(instr->value());
1929 LOperand* key = clobbers_key 1897 bool clobbers_key = instr->key()->representation().IsTagged();
1930 ? UseTempRegister(instr->key()) 1898 LOperand* key = clobbers_key
1931 : UseRegisterOrConstantAtStart(instr->key()); 1899 ? UseTempRegister(instr->key())
1932 return new(zone()) LStoreKeyedFastElement(obj, key, val); 1900 : UseRegisterOrConstantAtStart(instr->key());
1901
1902 return new(zone()) LStoreKeyed(object, key, val);
1903 } else {
1904 bool needs_write_barrier = instr->NeedsWriteBarrier();
1905 ASSERT(instr->value()->representation().IsTagged());
1906
1907 LOperand* obj = UseTempRegister(instr->object());
1908 LOperand* val = needs_write_barrier
1909 ? UseTempRegister(instr->value())
1910 : UseRegisterAtStart(instr->value());
1911 LOperand* key = needs_write_barrier
1912 ? UseTempRegister(instr->key())
1913 : UseRegisterOrConstantAtStart(instr->key());
1914 return new(zone()) LStoreKeyed(obj, key, val);
1915 }
1916 } else {
1917 ElementsKind elements_kind = instr->elements_kind();
1918 ASSERT(
1919 (instr->value()->representation().IsInteger32() &&
1920 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1921 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1922 (instr->value()->representation().IsDouble() &&
1923 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1924 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1925 ASSERT(instr->external_pointer()->representation().IsExternal());
1926
1927 LOperand* external_pointer = UseRegister(instr->external_pointer());
1928 bool val_is_temp_register =
1929 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
1930 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
1931 LOperand* val = val_is_temp_register
1932 ? UseTempRegister(instr->value())
1933 : UseRegister(instr->value());
1934 bool clobbers_key = instr->key()->representation().IsTagged();
1935 LOperand* key = clobbers_key
1936 ? UseTempRegister(instr->key())
1937 : UseRegisterOrConstantAtStart(instr->key());
1938 return new(zone()) LStoreKeyed(external_pointer, key, val);
1939 }
1933 } 1940 }
1934 1941
1935 1942
1936 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement(
1937 HStoreKeyedFastDoubleElement* instr) {
1938 ASSERT(instr->value()->representation().IsDouble());
1939 ASSERT(instr->elements()->representation().IsTagged());
1940 ASSERT(instr->key()->representation().IsInteger32() ||
1941 instr->key()->representation().IsTagged());
1942
1943 LOperand* elements = UseRegisterAtStart(instr->elements());
1944 LOperand* val = UseTempRegister(instr->value());
1945 bool clobbers_key = instr->key()->representation().IsTagged();
1946 LOperand* key = clobbers_key
1947 ? UseTempRegister(instr->key())
1948 : UseRegisterOrConstantAtStart(instr->key());
1949 return new(zone()) LStoreKeyedFastDoubleElement(elements, key, val);
1950 }
1951
1952
1953 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement(
1954 HStoreKeyedSpecializedArrayElement* instr) {
1955 ElementsKind elements_kind = instr->elements_kind();
1956 ASSERT(
1957 (instr->value()->representation().IsInteger32() &&
1958 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1959 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1960 (instr->value()->representation().IsDouble() &&
1961 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1962 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1963 ASSERT(instr->external_pointer()->representation().IsExternal());
1964 ASSERT(instr->key()->representation().IsInteger32() ||
1965 instr->key()->representation().IsTagged());
1966
1967 LOperand* external_pointer = UseRegister(instr->external_pointer());
1968 bool val_is_temp_register =
1969 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
1970 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
1971 LOperand* val = val_is_temp_register
1972 ? UseTempRegister(instr->value())
1973 : UseRegister(instr->value());
1974 bool clobbers_key = instr->key()->representation().IsTagged();
1975 LOperand* key = clobbers_key
1976 ? UseTempRegister(instr->key())
1977 : UseRegisterOrConstantAtStart(instr->key());
1978 return new(zone()) LStoreKeyedSpecializedArrayElement(external_pointer,
1979 key, val);
1980 }
1981
1982
1983 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 1943 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
1984 LOperand* object = UseFixed(instr->object(), rdx); 1944 LOperand* object = UseFixed(instr->object(), rdx);
1985 LOperand* key = UseFixed(instr->key(), rcx); 1945 LOperand* key = UseFixed(instr->key(), rcx);
1986 LOperand* value = UseFixed(instr->value(), rax); 1946 LOperand* value = UseFixed(instr->value(), rax);
1987 1947
1988 ASSERT(instr->object()->representation().IsTagged()); 1948 ASSERT(instr->object()->representation().IsTagged());
1989 ASSERT(instr->key()->representation().IsTagged()); 1949 ASSERT(instr->key()->representation().IsTagged());
1990 ASSERT(instr->value()->representation().IsTagged()); 1950 ASSERT(instr->value()->representation().IsTagged());
1991 1951
1992 LStoreKeyedGeneric* result = 1952 LStoreKeyedGeneric* result =
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2270 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2311 LOperand* object = UseRegister(instr->object()); 2271 LOperand* object = UseRegister(instr->object());
2312 LOperand* index = UseTempRegister(instr->index()); 2272 LOperand* index = UseTempRegister(instr->index());
2313 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2273 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2314 } 2274 }
2315 2275
2316 2276
2317 } } // namespace v8::internal 2277 } } // namespace v8::internal
2318 2278
2319 #endif // V8_TARGET_ARCH_X64 2279 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/hydrogen-instructions.cc ('K') | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698