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

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: 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/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);
399 stream->Add("[");
400 key()->PrintTo(stream);
401 stream->Add("] <- ");
402 value()->PrintTo(stream);
403 }
404
405
406 void LStoreKeyedFastDoubleElement::PrintDataTo(StringStream* stream) {
407 elements()->PrintTo(stream); 398 elements()->PrintTo(stream);
408 stream->Add("["); 399 stream->Add("[");
409 key()->PrintTo(stream); 400 key()->PrintTo(stream);
410 stream->Add("] <- "); 401 stream->Add("] <- ");
411 value()->PrintTo(stream); 402 value()->PrintTo(stream);
412 } 403 }
413 404
414 405
415 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { 406 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
416 object()->PrintTo(stream); 407 object()->PrintTo(stream);
(...skipping 1419 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(HLoadKeyed* instr) {
1847 HLoadKeyedFastElement* instr) {
1848 ASSERT(instr->representation().IsTagged());
1849 ASSERT(instr->key()->representation().IsInteger32() || 1838 ASSERT(instr->key()->representation().IsInteger32() ||
1850 instr->key()->representation().IsTagged()); 1839 instr->key()->representation().IsTagged());
1851 LOperand* obj = UseRegisterAtStart(instr->object()); 1840 ElementsKind elements_kind = instr->elements_kind();
1852 bool clobbers_key = instr->key()->representation().IsTagged(); 1841 bool clobbers_key = instr->key()->representation().IsTagged();
1853 LOperand* key = clobbers_key 1842 LOperand* key = clobbers_key
1854 ? UseTempRegister(instr->key()) 1843 ? UseTempRegister(instr->key())
1855 : UseRegisterOrConstantAtStart(instr->key()); 1844 : UseRegisterOrConstantAtStart(instr->key());
1856 LLoadKeyedFastElement* result = 1845 LLoadKeyed* result = NULL;
1857 new(zone()) LLoadKeyedFastElement(obj, key); 1846
1858 if (instr->RequiresHoleCheck()) AssignEnvironment(result); 1847 if (!instr->is_external()) {
1859 return DefineAsRegister(result); 1848 LOperand* obj = UseRegisterAtStart(instr->elements());
1849 result = new(zone()) LLoadKeyed(obj, key);
1850 } else {
1851 ASSERT(
1852 (instr->representation().IsInteger32() &&
1853 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1854 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1855 (instr->representation().IsDouble() &&
1856 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1857 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1858 LOperand* external_pointer = UseRegister(instr->elements());
1859 result = new(zone()) LLoadKeyed(external_pointer, key);
1860 }
1861
1862 DefineAsRegister(result);
1863 bool can_deoptimize = instr->RequiresHoleCheck() ||
1864 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS);
1865 // An unsigned int array load might overflow and cause a deopt, make sure it
1866 // has an environment.
1867 return can_deoptimize ? AssignEnvironment(result) : result;
1860 } 1868 }
1861 1869
1862 1870
1863 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement(
1864 HLoadKeyedFastDoubleElement* instr) {
1865 ASSERT(instr->representation().IsDouble());
1866 ASSERT(instr->key()->representation().IsInteger32() ||
1867 instr->key()->representation().IsTagged());
1868 LOperand* elements = UseRegisterAtStart(instr->elements());
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
1878
1879 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement(
1880 HLoadKeyedSpecializedArrayElement* instr) {
1881 ElementsKind elements_kind = instr->elements_kind();
1882 ASSERT(
1883 (instr->representation().IsInteger32() &&
1884 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1885 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1886 (instr->representation().IsDouble() &&
1887 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1888 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1889 ASSERT(instr->key()->representation().IsInteger32() ||
1890 instr->key()->representation().IsTagged());
1891 LOperand* external_pointer = UseRegister(instr->external_pointer());
1892 bool clobbers_key = instr->key()->representation().IsTagged();
1893 LOperand* key = clobbers_key
1894 ? UseTempRegister(instr->key())
1895 : UseRegisterOrConstantAtStart(instr->key());
1896 LLoadKeyedSpecializedArrayElement* result =
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
1900 // has an environment.
1901 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ?
1902 AssignEnvironment(load_instr) : load_instr;
1903 }
1904
1905
1906 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 1871 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1907 LOperand* object = UseFixed(instr->object(), rdx); 1872 LOperand* object = UseFixed(instr->object(), rdx);
1908 LOperand* key = UseFixed(instr->key(), rax); 1873 LOperand* key = UseFixed(instr->key(), rax);
1909 1874
1910 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); 1875 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key);
1911 return MarkAsCall(DefineFixed(result, rax), instr); 1876 return MarkAsCall(DefineFixed(result, rax), instr);
1912 } 1877 }
1913 1878
1914 1879
1915 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( 1880 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
1916 HStoreKeyedFastElement* instr) { 1881 ElementsKind elements_kind = instr->elements_kind();
1917 bool needs_write_barrier = instr->NeedsWriteBarrier(); 1882 bool needs_write_barrier = instr->NeedsWriteBarrier();
1918 ASSERT(instr->value()->representation().IsTagged()); 1883 bool clobbers_key = instr->key()->representation().IsTagged();
1919 ASSERT(instr->object()->representation().IsTagged()); 1884 LOperand* key = (clobbers_key || needs_write_barrier)
1920 ASSERT(instr->key()->representation().IsInteger32() || 1885 ? UseTempRegister(instr->key())
1921 instr->key()->representation().IsTagged()); 1886 : UseRegisterOrConstantAtStart(instr->key());
1922 1887 bool val_is_temp_register =
1923 LOperand* obj = UseTempRegister(instr->object()); 1888 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
1924 LOperand* val = needs_write_barrier 1889 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
1890 LOperand* val = (needs_write_barrier || val_is_temp_register)
1925 ? UseTempRegister(instr->value()) 1891 ? UseTempRegister(instr->value())
1926 : UseRegisterAtStart(instr->value()); 1892 : UseRegisterAtStart(instr->value());
1927 bool clobbers_key = needs_write_barrier || 1893 LStoreKeyed* result = NULL;
1928 instr->key()->representation().IsTagged(); 1894
1929 LOperand* key = clobbers_key 1895 if (!instr->is_external()) {
1930 ? UseTempRegister(instr->key()) 1896 ASSERT(instr->elements()->representation().IsTagged());
1931 : UseRegisterOrConstantAtStart(instr->key()); 1897
1932 return new(zone()) LStoreKeyedFastElement(obj, key, val); 1898 LOperand* object = NULL;
1899 if (instr->value()->representation().IsDouble()) {
1900 object = UseRegisterAtStart(instr->elements());
1901 } else {
1902 ASSERT(instr->value()->representation().IsTagged());
1903 object = UseTempRegister(instr->elements());
1904 }
1905
1906 result = new(zone()) LStoreKeyed(object, key, val);
1907 } else {
1908 ASSERT(
1909 (instr->value()->representation().IsInteger32() &&
1910 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1911 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1912 (instr->value()->representation().IsDouble() &&
1913 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1914 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1915 ASSERT(instr->elements()->representation().IsExternal());
1916
1917 LOperand* external_pointer = UseRegister(instr->elements());
1918 result = new(zone()) LStoreKeyed(external_pointer, key, val);
1919 }
1920
1921 ASSERT(result != NULL);
1922 return result;
1933 } 1923 }
1934 1924
1935 1925
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) { 1926 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
1984 LOperand* object = UseFixed(instr->object(), rdx); 1927 LOperand* object = UseFixed(instr->object(), rdx);
1985 LOperand* key = UseFixed(instr->key(), rcx); 1928 LOperand* key = UseFixed(instr->key(), rcx);
1986 LOperand* value = UseFixed(instr->value(), rax); 1929 LOperand* value = UseFixed(instr->value(), rax);
1987 1930
1988 ASSERT(instr->object()->representation().IsTagged()); 1931 ASSERT(instr->object()->representation().IsTagged());
1989 ASSERT(instr->key()->representation().IsTagged()); 1932 ASSERT(instr->key()->representation().IsTagged());
1990 ASSERT(instr->value()->representation().IsTagged()); 1933 ASSERT(instr->value()->representation().IsTagged());
1991 1934
1992 LStoreKeyedGeneric* result = 1935 LStoreKeyedGeneric* result =
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2253 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2311 LOperand* object = UseRegister(instr->object()); 2254 LOperand* object = UseRegister(instr->object());
2312 LOperand* index = UseTempRegister(instr->index()); 2255 LOperand* index = UseTempRegister(instr->index());
2313 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2256 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2314 } 2257 }
2315 2258
2316 2259
2317 } } // namespace v8::internal 2260 } } // namespace v8::internal
2318 2261
2319 #endif // V8_TARGET_ARCH_X64 2262 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698