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

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

Issue 214613004: Only assign environments when they are actually needed. (ARM and ARM64 only) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 6 years, 8 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
« no previous file with comments | « src/arm64/lithium-arm64.cc ('k') | src/x64/lithium-x64.cc » ('j') | 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 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 // All HForceRepresentation instructions should be eliminated in the 1875 // All HForceRepresentation instructions should be eliminated in the
1876 // representation change phase of Hydrogen. 1876 // representation change phase of Hydrogen.
1877 UNREACHABLE(); 1877 UNREACHABLE();
1878 return NULL; 1878 return NULL;
1879 } 1879 }
1880 1880
1881 1881
1882 LInstruction* LChunkBuilder::DoChange(HChange* instr) { 1882 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1883 Representation from = instr->from(); 1883 Representation from = instr->from();
1884 Representation to = instr->to(); 1884 Representation to = instr->to();
1885 HValue* val = instr->value();
1885 if (from.IsSmi()) { 1886 if (from.IsSmi()) {
1886 if (to.IsTagged()) { 1887 if (to.IsTagged()) {
1887 LOperand* value = UseRegister(instr->value()); 1888 LOperand* value = UseRegister(val);
1888 return DefineSameAsFirst(new(zone()) LDummyUse(value)); 1889 return DefineSameAsFirst(new(zone()) LDummyUse(value));
1889 } 1890 }
1890 from = Representation::Tagged(); 1891 from = Representation::Tagged();
1891 } 1892 }
1892 // Only mark conversions that might need to allocate as calling rather than
1893 // all changes. This makes simple, non-allocating conversion not have to force
1894 // building a stack frame.
1895 if (from.IsTagged()) { 1893 if (from.IsTagged()) {
1896 if (to.IsDouble()) { 1894 if (to.IsDouble()) {
1897 LOperand* value = UseRegister(instr->value()); 1895 LOperand* value = UseRegister(val);
1898 // Temp register only necessary for minus zero check.
1899 LOperand* temp = TempRegister(); 1896 LOperand* temp = TempRegister();
1900 LInstruction* result = DefineAsRegister( 1897 LInstruction* result =
1901 new(zone()) LNumberUntagD(value, temp)); 1898 DefineAsRegister(new(zone()) LNumberUntagD(value, temp));
1902 if (!instr->value()->representation().IsSmi()) { 1899 if (!val->representation().IsSmi()) result = AssignEnvironment(result);
1903 result = AssignEnvironment(result);
1904 }
1905 return result; 1900 return result;
1906 } else if (to.IsSmi()) { 1901 } else if (to.IsSmi()) {
1907 HValue* val = instr->value();
1908 LOperand* value = UseRegister(val); 1902 LOperand* value = UseRegister(val);
1909 if (val->type().IsSmi()) { 1903 if (val->type().IsSmi()) {
1910 return DefineSameAsFirst(new(zone()) LDummyUse(value)); 1904 return DefineSameAsFirst(new(zone()) LDummyUse(value));
1911 } 1905 }
1912 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); 1906 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
1913 } else { 1907 } else {
1914 ASSERT(to.IsInteger32()); 1908 ASSERT(to.IsInteger32());
1915 HValue* val = instr->value();
1916 if (val->type().IsSmi() || val->representation().IsSmi()) { 1909 if (val->type().IsSmi() || val->representation().IsSmi()) {
1917 LOperand* value = UseRegister(val); 1910 LOperand* value = UseRegister(val);
1918 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); 1911 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
1919 } else { 1912 } else {
1913 LOperand* value = UseRegister(val);
1920 bool truncating = instr->CanTruncateToInt32(); 1914 bool truncating = instr->CanTruncateToInt32();
1921 LOperand* xmm_temp = 1915 LOperand* xmm_temp =
1922 (CpuFeatures::IsSafeForSnapshot(SSE2) && !truncating) 1916 (CpuFeatures::IsSafeForSnapshot(SSE2) && !truncating)
1923 ? FixedTemp(xmm1) : NULL; 1917 ? FixedTemp(xmm1) : NULL;
1924 LInstruction* result = DefineSameAsFirst( 1918 LInstruction* result =
1925 new(zone()) LTaggedToI(UseRegister(val), xmm_temp)); 1919 DefineSameAsFirst(new(zone()) LTaggedToI(value, xmm_temp));
1926 if (!instr->value()->representation().IsSmi()) { 1920 if (!val->representation().IsSmi()) {
1927 // Note: Only deopts in deferred code. 1921 // Note: Only deopts in deferred code.
1928 result = AssignEnvironment(result); 1922 result = AssignEnvironment(result);
1929 } 1923 }
1930 return result; 1924 return result;
1931 } 1925 }
1932 } 1926 }
1933 } else if (from.IsDouble()) { 1927 } else if (from.IsDouble()) {
1934 if (to.IsTagged()) { 1928 if (to.IsTagged()) {
1935 info()->MarkAsDeferredCalling(); 1929 info()->MarkAsDeferredCalling();
1936 LOperand* value = UseRegisterAtStart(instr->value()); 1930 LOperand* value = UseRegisterAtStart(val);
1937 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL; 1931 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL;
1938
1939 // Make sure that temp and result_temp are different registers.
1940 LUnallocated* result_temp = TempRegister(); 1932 LUnallocated* result_temp = TempRegister();
1941 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); 1933 LNumberTagD* result = new(zone()) LNumberTagD(value, temp);
1942 return AssignPointerMap(Define(result, result_temp)); 1934 return AssignPointerMap(Define(result, result_temp));
1943 } else if (to.IsSmi()) { 1935 } else if (to.IsSmi()) {
1944 LOperand* value = UseRegister(instr->value()); 1936 LOperand* value = UseRegister(val);
1945 return AssignEnvironment( 1937 return AssignEnvironment(
1946 DefineAsRegister(new(zone()) LDoubleToSmi(value))); 1938 DefineAsRegister(new(zone()) LDoubleToSmi(value)));
1947 } else { 1939 } else {
1948 ASSERT(to.IsInteger32()); 1940 ASSERT(to.IsInteger32());
1949 bool truncating = instr->CanTruncateToInt32(); 1941 bool truncating = instr->CanTruncateToInt32();
1950 bool needs_temp = CpuFeatures::IsSafeForSnapshot(SSE2) && !truncating; 1942 bool needs_temp = CpuFeatures::IsSafeForSnapshot(SSE2) && !truncating;
1951 LOperand* value = needs_temp ? 1943 LOperand* value = needs_temp ? UseTempRegister(val) : UseRegister(val);
1952 UseTempRegister(instr->value()) : UseRegister(instr->value());
1953 LOperand* temp = needs_temp ? TempRegister() : NULL; 1944 LOperand* temp = needs_temp ? TempRegister() : NULL;
1954 LInstruction* result = 1945 LInstruction* result =
1955 DefineAsRegister(new(zone()) LDoubleToI(value, temp)); 1946 DefineAsRegister(new(zone()) LDoubleToI(value, temp));
1956 if (!truncating) result = AssignEnvironment(result); 1947 if (!truncating) result = AssignEnvironment(result);
1957 return result; 1948 return result;
1958 } 1949 }
1959 } else if (from.IsInteger32()) { 1950 } else if (from.IsInteger32()) {
1960 info()->MarkAsDeferredCalling(); 1951 info()->MarkAsDeferredCalling();
1961 if (to.IsTagged()) { 1952 if (to.IsTagged()) {
1962 HValue* val = instr->value();
1963 LOperand* value = UseRegister(val);
1964 if (!instr->CheckFlag(HValue::kCanOverflow)) { 1953 if (!instr->CheckFlag(HValue::kCanOverflow)) {
1954 LOperand* value = UseRegister(val);
1965 return DefineSameAsFirst(new(zone()) LSmiTag(value)); 1955 return DefineSameAsFirst(new(zone()) LSmiTag(value));
1966 } else if (val->CheckFlag(HInstruction::kUint32)) { 1956 } else if (val->CheckFlag(HInstruction::kUint32)) {
1957 LOperand* value = UseRegister(val);
1967 LOperand* temp1 = TempRegister(); 1958 LOperand* temp1 = TempRegister();
1968 LOperand* temp2 = CpuFeatures::IsSupported(SSE2) ? FixedTemp(xmm1) 1959 LOperand* temp2 =
1969 : NULL; 1960 CpuFeatures::IsSupported(SSE2) ? FixedTemp(xmm1) : NULL;
1970 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); 1961 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2);
1971 return AssignPointerMap(DefineSameAsFirst(result)); 1962 return AssignPointerMap(DefineSameAsFirst(result));
1972 } else { 1963 } else {
1964 LOperand* value = UseRegister(val);
1973 LOperand* temp = TempRegister(); 1965 LOperand* temp = TempRegister();
1974 LNumberTagI* result = new(zone()) LNumberTagI(value, temp); 1966 LNumberTagI* result = new(zone()) LNumberTagI(value, temp);
1975 return AssignPointerMap(DefineSameAsFirst(result)); 1967 return AssignPointerMap(DefineSameAsFirst(result));
1976 } 1968 }
1977 } else if (to.IsSmi()) { 1969 } else if (to.IsSmi()) {
1978 HValue* val = instr->value();
1979 LOperand* value = UseRegister(val); 1970 LOperand* value = UseRegister(val);
1980 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value)); 1971 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value));
1981 if (instr->CheckFlag(HValue::kCanOverflow)) { 1972 if (instr->CheckFlag(HValue::kCanOverflow)) {
1982 result = AssignEnvironment(result); 1973 result = AssignEnvironment(result);
1983 } 1974 }
1984 return result; 1975 return result;
1985 } else { 1976 } else {
1986 ASSERT(to.IsDouble()); 1977 ASSERT(to.IsDouble());
1987 if (instr->value()->CheckFlag(HInstruction::kUint32)) { 1978 if (val->CheckFlag(HInstruction::kUint32)) {
1988 LOperand* temp = FixedTemp(xmm1); 1979 LOperand* temp = FixedTemp(xmm1);
1989 return DefineAsRegister( 1980 return DefineAsRegister(
1990 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp)); 1981 new(zone()) LUint32ToDouble(UseRegister(val), temp));
1991 } else { 1982 } else {
1992 return DefineAsRegister( 1983 return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val)));
1993 new(zone()) LInteger32ToDouble(Use(instr->value())));
1994 } 1984 }
1995 } 1985 }
1996 } 1986 }
1997 UNREACHABLE(); 1987 UNREACHABLE();
1998 return NULL; 1988 return NULL;
1999 } 1989 }
2000 1990
2001 1991
2002 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) { 1992 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
2003 LOperand* value = UseAtStart(instr->value()); 1993 LOperand* value = UseAtStart(instr->value());
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 LOperand* index = UseTempRegister(instr->index()); 2694 LOperand* index = UseTempRegister(instr->index());
2705 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); 2695 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index);
2706 LInstruction* result = DefineSameAsFirst(load); 2696 LInstruction* result = DefineSameAsFirst(load);
2707 return AssignPointerMap(result); 2697 return AssignPointerMap(result);
2708 } 2698 }
2709 2699
2710 2700
2711 } } // namespace v8::internal 2701 } } // namespace v8::internal
2712 2702
2713 #endif // V8_TARGET_ARCH_IA32 2703 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm64/lithium-arm64.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698