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

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

Issue 15303004: Implement HChange support for Smis and use it in Load/StoreNameField (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 7 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
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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 // All HForceRepresentation instructions should be eliminated in the 1880 // All HForceRepresentation instructions should be eliminated in the
1881 // representation change phase of Hydrogen. 1881 // representation change phase of Hydrogen.
1882 UNREACHABLE(); 1882 UNREACHABLE();
1883 return NULL; 1883 return NULL;
1884 } 1884 }
1885 1885
1886 1886
1887 LInstruction* LChunkBuilder::DoChange(HChange* instr) { 1887 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1888 Representation from = instr->from(); 1888 Representation from = instr->from();
1889 Representation to = instr->to(); 1889 Representation to = instr->to();
1890 if (from.IsSmi()) {
1891 if (to.IsTagged()) {
1892 LOperand* value = UseRegister(instr->value());
1893 return DefineSameAsFirst(new(zone()) LDummyUse(value));
1894 }
1895 from = Representation::Tagged();
1896 }
1890 if (from.IsTagged()) { 1897 if (from.IsTagged()) {
1891 if (to.IsDouble()) { 1898 if (to.IsDouble()) {
1892 info()->MarkAsDeferredCalling(); 1899 info()->MarkAsDeferredCalling();
1893 LOperand* value = UseRegister(instr->value()); 1900 LOperand* value = UseRegister(instr->value());
1894 LNumberUntagD* res = new(zone()) LNumberUntagD(value); 1901 LNumberUntagD* res = new(zone()) LNumberUntagD(value);
1895 return AssignEnvironment(DefineAsRegister(res)); 1902 return AssignEnvironment(DefineAsRegister(res));
1903 } else if (to.IsSmi()) {
1904 HValue* val = instr->value();
1905 LOperand* value = UseRegisterAtStart(val);
1906 return AssignEnvironment(
1907 DefineSameAsFirst(new(zone()) LCheckSmi(value)));
1896 } else { 1908 } else {
1897 ASSERT(to.IsInteger32()); 1909 ASSERT(to.IsInteger32());
1898 LOperand* value = NULL; 1910 LOperand* value = NULL;
1899 LInstruction* res = NULL; 1911 LInstruction* res = NULL;
1900 if (instr->value()->type().IsSmi()) { 1912 if (instr->value()->type().IsSmi()) {
1901 value = UseRegisterAtStart(instr->value()); 1913 value = UseRegisterAtStart(instr->value());
1902 res = DefineAsRegister(new(zone()) LSmiUntag(value, false)); 1914 res = DefineAsRegister(new(zone()) LSmiUntag(value, false));
1903 } else { 1915 } else {
1904 value = UseRegister(instr->value()); 1916 value = UseRegister(instr->value());
1905 LOperand* temp1 = TempRegister(); 1917 LOperand* temp1 = TempRegister();
(...skipping 14 matching lines...) Expand all
1920 LOperand* value = UseRegister(instr->value()); 1932 LOperand* value = UseRegister(instr->value());
1921 LOperand* temp1 = TempRegister(); 1933 LOperand* temp1 = TempRegister();
1922 LOperand* temp2 = TempRegister(); 1934 LOperand* temp2 = TempRegister();
1923 1935
1924 // Make sure that the temp and result_temp registers are 1936 // Make sure that the temp and result_temp registers are
1925 // different. 1937 // different.
1926 LUnallocated* result_temp = TempRegister(); 1938 LUnallocated* result_temp = TempRegister();
1927 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2); 1939 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2);
1928 Define(result, result_temp); 1940 Define(result, result_temp);
1929 return AssignPointerMap(result); 1941 return AssignPointerMap(result);
1942 } else if (to.IsSmi()) {
1943 LOperand* value = UseRegister(instr->value());
1944 return AssignEnvironment(DefineAsRegister(new(zone()) LDoubleToSmi(value,
1945 TempRegister(), TempRegister())));
1930 } else { 1946 } else {
1931 ASSERT(to.IsInteger32()); 1947 ASSERT(to.IsInteger32());
1932 LOperand* value = UseRegister(instr->value()); 1948 LOperand* value = UseRegister(instr->value());
1933 LOperand* temp1 = TempRegister(); 1949 LOperand* temp1 = TempRegister();
1934 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL; 1950 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL;
1935 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2); 1951 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2);
1936 return AssignEnvironment(DefineAsRegister(res)); 1952 return AssignEnvironment(DefineAsRegister(res));
1937 } 1953 }
1938 } else if (from.IsInteger32()) { 1954 } else if (from.IsInteger32()) {
1939 info()->MarkAsDeferredCalling(); 1955 info()->MarkAsDeferredCalling();
1940 if (to.IsTagged()) { 1956 if (to.IsTagged()) {
1941 HValue* val = instr->value(); 1957 HValue* val = instr->value();
1942 LOperand* value = UseRegisterAtStart(val); 1958 LOperand* value = UseRegisterAtStart(val);
1943 if (val->CheckFlag(HInstruction::kUint32)) { 1959 if (val->CheckFlag(HInstruction::kUint32)) {
1944 LNumberTagU* result = new(zone()) LNumberTagU(value); 1960 LNumberTagU* result = new(zone()) LNumberTagU(value);
1945 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1961 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1946 } else if (val->HasRange() && val->range()->IsInSmiRange()) { 1962 } else if (val->HasRange() && val->range()->IsInSmiRange()) {
1947 return DefineAsRegister(new(zone()) LSmiTag(value)); 1963 return DefineAsRegister(new(zone()) LSmiTag(value));
1948 } else { 1964 } else {
1949 LNumberTagI* result = new(zone()) LNumberTagI(value); 1965 LNumberTagI* result = new(zone()) LNumberTagI(value);
1950 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1966 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1951 } 1967 }
1968 } else if (to.IsSmi()) {
1969 HValue* val = instr->value();
1970 LOperand* value = UseRegister(val);
1971 LInstruction* result =
1972 DefineSameAsFirst(new(zone()) LInteger32ToSmi(value));
1973 if (val->HasRange() && val->range()->IsInSmiRange()) {
1974 return result;
1975 }
1976 return AssignEnvironment(result);
1952 } else { 1977 } else {
1953 ASSERT(to.IsDouble()); 1978 ASSERT(to.IsDouble());
1954 if (instr->value()->CheckFlag(HInstruction::kUint32)) { 1979 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
1955 return DefineAsRegister( 1980 return DefineAsRegister(
1956 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); 1981 new(zone()) LUint32ToDouble(UseRegister(instr->value())));
1957 } else { 1982 } else {
1958 return DefineAsRegister( 1983 return DefineAsRegister(
1959 new(zone()) LInteger32ToDouble(Use(instr->value()))); 1984 new(zone()) LInteger32ToDouble(Use(instr->value())));
1960 } 1985 }
1961 } 1986 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 parameter_count); 2060 parameter_count);
2036 } 2061 }
2037 2062
2038 2063
2039 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { 2064 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
2040 Representation r = instr->representation(); 2065 Representation r = instr->representation();
2041 if (r.IsInteger32()) { 2066 if (r.IsInteger32()) {
2042 return DefineAsRegister(new(zone()) LConstantI); 2067 return DefineAsRegister(new(zone()) LConstantI);
2043 } else if (r.IsDouble()) { 2068 } else if (r.IsDouble()) {
2044 return DefineAsRegister(new(zone()) LConstantD); 2069 return DefineAsRegister(new(zone()) LConstantD);
2045 } else if (r.IsTagged()) { 2070 } else if (r.IsTagged() || r.IsSmi()) {
2046 return DefineAsRegister(new(zone()) LConstantT); 2071 return DefineAsRegister(new(zone()) LConstantT);
2047 } else { 2072 } else {
2048 UNREACHABLE(); 2073 UNREACHABLE();
2049 return NULL; 2074 return NULL;
2050 } 2075 }
2051 } 2076 }
2052 2077
2053 2078
2054 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { 2079 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2055 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell; 2080 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell;
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 2633
2609 2634
2610 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2635 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2611 LOperand* object = UseRegister(instr->object()); 2636 LOperand* object = UseRegister(instr->object());
2612 LOperand* index = UseRegister(instr->index()); 2637 LOperand* index = UseRegister(instr->index());
2613 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2638 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2614 } 2639 }
2615 2640
2616 2641
2617 } } // namespace v8::internal 2642 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | src/ia32/lithium-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698