Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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); | 376 object()->PrintTo(stream); |
| 377 stream->Add("["); | 377 stream->Add("["); |
| 378 key()->PrintTo(stream); | 378 key()->PrintTo(stream); |
| 379 stream->Add("] <- "); | 379 stream->Add("] <- "); |
| 380 value()->PrintTo(stream); | 380 value()->PrintTo(stream); |
| 381 } | 381 } |
| 382 | 382 |
| 383 | 383 |
| 384 void LStoreKeyedFastDoubleElement::PrintDataTo(StringStream* stream) { | |
| 385 elements()->PrintTo(stream); | |
| 386 stream->Add("["); | |
| 387 key()->PrintTo(stream); | |
| 388 stream->Add("] <- "); | |
| 389 value()->PrintTo(stream); | |
| 390 } | |
| 391 | |
| 392 | |
| 393 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { | 384 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 394 object()->PrintTo(stream); | 385 object()->PrintTo(stream); |
| 395 stream->Add("["); | 386 stream->Add("["); |
| 396 key()->PrintTo(stream); | 387 key()->PrintTo(stream); |
| 397 stream->Add("] <- "); | 388 stream->Add("] <- "); |
| 398 value()->PrintTo(stream); | 389 value()->PrintTo(stream); |
| 399 } | 390 } |
| 400 | 391 |
| 401 | 392 |
| 402 void LTransitionElementsKind::PrintDataTo(StringStream* stream) { | 393 void LTransitionElementsKind::PrintDataTo(StringStream* stream) { |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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) { |
| 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()); | |
| 1869 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | |
| 1870 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key); | |
| 1871 if (instr->RequiresHoleCheck()) AssignEnvironment(result); | |
| 1872 return DefineAsRegister(result); | |
| 1873 } | |
| 1874 | 1858 |
| 1859 if (!instr->is_external()) { | |
| 1860 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | |
| 1861 LOperand* obj = NULL; | |
| 1862 if (instr->representation().IsDouble()) { | |
| 1863 obj = UseTempRegister(instr->object()); | |
| 1864 } else { | |
| 1865 ASSERT(instr->representation().IsTagged()); | |
| 1866 obj = UseRegisterAtStart(instr->object()); | |
| 1867 } | |
| 1875 | 1868 |
| 1876 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( | 1869 LLoadKeyed* result = new(zone()) LLoadKeyed(obj, key); |
| 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 | 1870 |
| 1871 // TODO(mvstanton): looks like we always called AssignEnvironment | |
| 1872 // for the FastDouble | |
| 1873 // case, even if it didn't need a hole check (packed double case). | |
| 1874 // I've quit doing that...is that okay? | |
| 1875 if (instr->RequiresHoleCheck()) AssignEnvironment(result); | |
|
danno
2012/10/21 20:44:41
make sure that AssignEnvironment is the last thing
mvstanton
2012/10/23 23:44:20
Done.
| |
| 1876 return DefineAsRegister(result); | |
| 1877 } | |
| 1888 | 1878 |
| 1889 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | |
| 1890 HLoadKeyedSpecializedArrayElement* instr) { | |
| 1891 ElementsKind elements_kind = instr->elements_kind(); | 1879 ElementsKind elements_kind = instr->elements_kind(); |
| 1892 ASSERT( | 1880 ASSERT( |
| 1893 (instr->representation().IsInteger32() && | 1881 (instr->representation().IsInteger32() && |
| 1894 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1882 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1895 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 1883 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1896 (instr->representation().IsDouble() && | 1884 (instr->representation().IsDouble() && |
| 1897 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1885 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1898 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 1886 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1899 ASSERT(instr->key()->representation().IsInteger32() || | |
| 1900 instr->key()->representation().IsTagged()); | |
| 1901 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1887 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1902 LOperand* key = UseRegisterOrConstant(instr->key()); | 1888 LOperand* key = UseRegisterOrConstant(instr->key()); |
|
danno
2012/10/21 20:44:41
This can be UseRegisterOrConstantAtStart, I think,
mvstanton
2012/10/23 23:44:20
Done.
| |
| 1903 LLoadKeyedSpecializedArrayElement* result = | 1889 LLoadKeyed* result = |
| 1904 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, key); | 1890 new(zone()) LLoadKeyed(external_pointer, key); |
| 1905 LInstruction* load_instr = DefineAsRegister(result); | 1891 LInstruction* load_instr = DefineAsRegister(result); |
| 1906 // An unsigned int array load might overflow and cause a deopt, make sure it | 1892 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1907 // has an environment. | 1893 // has an environment. |
| 1908 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ? | 1894 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) ? |
|
danno
2012/10/21 20:44:41
You can combine this exit sequence with the one fo
mvstanton
2012/10/23 23:44:20
Thanks, done. Indeed I could combine a lot more co
| |
| 1909 AssignEnvironment(load_instr) : load_instr; | 1895 AssignEnvironment(load_instr) : load_instr; |
| 1910 } | 1896 } |
| 1911 | 1897 |
| 1912 | 1898 |
| 1913 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1899 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1914 LOperand* object = UseFixed(instr->object(), r1); | 1900 LOperand* object = UseFixed(instr->object(), r1); |
| 1915 LOperand* key = UseFixed(instr->key(), r0); | 1901 LOperand* key = UseFixed(instr->key(), r0); |
| 1916 | 1902 |
| 1917 LInstruction* result = | 1903 LInstruction* result = |
| 1918 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); | 1904 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); |
| 1919 return MarkAsCall(result, instr); | 1905 return MarkAsCall(result, instr); |
| 1920 } | 1906 } |
| 1921 | 1907 |
| 1922 | 1908 |
| 1923 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( | 1909 LInstruction* LChunkBuilder::DoStoreKeyed( |
| 1924 HStoreKeyedFastElement* instr) { | 1910 HStoreKeyed* instr) { |
| 1925 bool needs_write_barrier = instr->NeedsWriteBarrier(); | |
| 1926 ASSERT(instr->value()->representation().IsTagged()); | |
| 1927 ASSERT(instr->object()->representation().IsTagged()); | |
| 1928 ASSERT(instr->key()->representation().IsInteger32() || | 1911 ASSERT(instr->key()->representation().IsInteger32() || |
| 1929 instr->key()->representation().IsTagged()); | 1912 instr->key()->representation().IsTagged()); |
| 1930 | 1913 |
| 1931 LOperand* obj = UseTempRegister(instr->object()); | 1914 if (!instr->is_external()) { |
| 1932 LOperand* val = needs_write_barrier | 1915 ASSERT(instr->object()->representation().IsTagged()); |
| 1933 ? UseTempRegister(instr->value()) | 1916 |
| 1934 : UseRegisterAtStart(instr->value()); | 1917 if (instr->value()->representation().IsDouble()) { |
| 1935 LOperand* key = needs_write_barrier | 1918 LOperand* object = UseRegisterAtStart(instr->object()); |
| 1936 ? UseTempRegister(instr->key()) | 1919 LOperand* val = UseTempRegister(instr->value()); |
| 1937 : UseRegisterOrConstantAtStart(instr->key()); | 1920 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1938 return new(zone()) LStoreKeyedFastElement(obj, key, val); | 1921 |
| 1922 return new(zone()) LStoreKeyed(object, key, val); | |
| 1923 } else { | |
| 1924 bool needs_write_barrier = instr->NeedsWriteBarrier(); | |
| 1925 ASSERT(instr->value()->representation().IsTagged()); | |
| 1926 | |
| 1927 LOperand* obj = UseTempRegister(instr->object()); | |
| 1928 LOperand* val = needs_write_barrier | |
| 1929 ? UseTempRegister(instr->value()) | |
| 1930 : UseRegisterAtStart(instr->value()); | |
| 1931 LOperand* key = needs_write_barrier | |
| 1932 ? UseTempRegister(instr->key()) | |
| 1933 : UseRegisterOrConstantAtStart(instr->key()); | |
| 1934 return new(zone()) LStoreKeyed(obj, key, val); | |
| 1935 } | |
| 1936 } else { | |
| 1937 ElementsKind elements_kind = instr->elements_kind(); | |
| 1938 ASSERT( | |
| 1939 (instr->value()->representation().IsInteger32() && | |
| 1940 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | |
| 1941 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 1942 (instr->value()->representation().IsDouble() && | |
| 1943 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | |
| 1944 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | |
| 1945 ASSERT(instr->external_pointer()->representation().IsExternal()); | |
| 1946 | |
| 1947 LOperand* external_pointer = UseRegister(instr->external_pointer()); | |
| 1948 bool val_is_temp_register = | |
| 1949 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | |
| 1950 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | |
| 1951 LOperand* val = val_is_temp_register | |
| 1952 ? UseTempRegister(instr->value()) | |
| 1953 : UseRegister(instr->value()); | |
|
danno
2012/10/21 20:44:41
Use the previous four lines to compute val in both
mvstanton
2012/10/23 23:44:20
Done, but there was a pretty big variation in the
| |
| 1954 LOperand* key = UseRegisterOrConstant(instr->key()); | |
|
danno
2012/10/21 20:44:41
As in load case, use LOperand* key = UseRegisterOr
mvstanton
2012/10/23 23:44:20
Done.
| |
| 1955 | |
| 1956 return new(zone()) LStoreKeyed(external_pointer, key, val); | |
| 1957 } | |
| 1939 } | 1958 } |
| 1940 | 1959 |
| 1941 | 1960 |
| 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) { | 1961 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 1987 LOperand* obj = UseFixed(instr->object(), r2); | 1962 LOperand* obj = UseFixed(instr->object(), r2); |
| 1988 LOperand* key = UseFixed(instr->key(), r1); | 1963 LOperand* key = UseFixed(instr->key(), r1); |
| 1989 LOperand* val = UseFixed(instr->value(), r0); | 1964 LOperand* val = UseFixed(instr->value(), r0); |
| 1990 | 1965 |
| 1991 ASSERT(instr->object()->representation().IsTagged()); | 1966 ASSERT(instr->object()->representation().IsTagged()); |
| 1992 ASSERT(instr->key()->representation().IsTagged()); | 1967 ASSERT(instr->key()->representation().IsTagged()); |
| 1993 ASSERT(instr->value()->representation().IsTagged()); | 1968 ASSERT(instr->value()->representation().IsTagged()); |
| 1994 | 1969 |
| 1995 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr); | 1970 return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2306 | 2281 |
| 2307 | 2282 |
| 2308 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2283 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2309 LOperand* object = UseRegister(instr->object()); | 2284 LOperand* object = UseRegister(instr->object()); |
| 2310 LOperand* index = UseRegister(instr->index()); | 2285 LOperand* index = UseRegister(instr->index()); |
| 2311 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2286 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2312 } | 2287 } |
| 2313 | 2288 |
| 2314 | 2289 |
| 2315 } } // namespace v8::internal | 2290 } } // namespace v8::internal |
| OLD | NEW |