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

Side by Side Diff: src/ia32/lithium-ia32.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
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/lithium.h » ('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 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 // All HForceRepresentation instructions should be eliminated in the 1901 // All HForceRepresentation instructions should be eliminated in the
1902 // representation change phase of Hydrogen. 1902 // representation change phase of Hydrogen.
1903 UNREACHABLE(); 1903 UNREACHABLE();
1904 return NULL; 1904 return NULL;
1905 } 1905 }
1906 1906
1907 1907
1908 LInstruction* LChunkBuilder::DoChange(HChange* instr) { 1908 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1909 Representation from = instr->from(); 1909 Representation from = instr->from();
1910 Representation to = instr->to(); 1910 Representation to = instr->to();
1911 if (from.IsSmi()) {
1912 if (to.IsTagged()) {
1913 LOperand* value = UseRegister(instr->value());
1914 return DefineSameAsFirst(new(zone()) LDummyUse(value));
1915 }
1916 from = Representation::Tagged();
1917 }
1911 // Only mark conversions that might need to allocate as calling rather than 1918 // Only mark conversions that might need to allocate as calling rather than
1912 // all changes. This makes simple, non-allocating conversion not have to force 1919 // all changes. This makes simple, non-allocating conversion not have to force
1913 // building a stack frame. 1920 // building a stack frame.
1914 if (from.IsTagged()) { 1921 if (from.IsTagged()) {
1915 if (to.IsDouble()) { 1922 if (to.IsDouble()) {
1916 info()->MarkAsDeferredCalling(); 1923 info()->MarkAsDeferredCalling();
1917 LOperand* value = UseRegister(instr->value()); 1924 LOperand* value = UseRegister(instr->value());
1918 // Temp register only necessary for minus zero check. 1925 // Temp register only necessary for minus zero check.
1919 LOperand* temp = instr->deoptimize_on_minus_zero() 1926 LOperand* temp = instr->deoptimize_on_minus_zero()
1920 ? TempRegister() 1927 ? TempRegister()
1921 : NULL; 1928 : NULL;
1922 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); 1929 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp);
1923 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 1930 if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
1924 return AssignEnvironment(DefineAsRegister(res)); 1931 return AssignEnvironment(DefineAsRegister(res));
1925 } else { 1932 } else {
1926 return AssignEnvironment(DefineX87TOS(res)); 1933 return AssignEnvironment(DefineX87TOS(res));
1927 } 1934 }
1935 } else if (to.IsSmi()) {
1936 HValue* val = instr->value();
1937 LOperand* value = UseRegisterAtStart(val);
1938 return AssignEnvironment(
1939 DefineSameAsFirst(new(zone()) LCheckSmi(value)));
1928 } else { 1940 } else {
1929 ASSERT(to.IsInteger32()); 1941 ASSERT(to.IsInteger32());
1930 if (instr->value()->type().IsSmi()) { 1942 if (instr->value()->type().IsSmi()) {
1931 LOperand* value = UseRegister(instr->value()); 1943 LOperand* value = UseRegister(instr->value());
1932 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); 1944 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
1933 } else { 1945 } else {
1934 bool truncating = instr->CanTruncateToInt32(); 1946 bool truncating = instr->CanTruncateToInt32();
1935 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 1947 if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
1936 LOperand* value = UseRegister(instr->value()); 1948 LOperand* value = UseRegister(instr->value());
1937 LOperand* xmm_temp = 1949 LOperand* xmm_temp =
(...skipping 16 matching lines...) Expand all
1954 info()->MarkAsDeferredCalling(); 1966 info()->MarkAsDeferredCalling();
1955 LOperand* value = CpuFeatures::IsSupported(SSE2) 1967 LOperand* value = CpuFeatures::IsSupported(SSE2)
1956 ? UseRegisterAtStart(instr->value()) 1968 ? UseRegisterAtStart(instr->value())
1957 : UseAtStart(instr->value()); 1969 : UseAtStart(instr->value());
1958 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL; 1970 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL;
1959 1971
1960 // Make sure that temp and result_temp are different registers. 1972 // Make sure that temp and result_temp are different registers.
1961 LUnallocated* result_temp = TempRegister(); 1973 LUnallocated* result_temp = TempRegister();
1962 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); 1974 LNumberTagD* result = new(zone()) LNumberTagD(value, temp);
1963 return AssignPointerMap(Define(result, result_temp)); 1975 return AssignPointerMap(Define(result, result_temp));
1976 } else if (to.IsSmi()) {
1977 LOperand* value = UseRegister(instr->value());
1978 return AssignEnvironment(
1979 DefineAsRegister(new(zone()) LDoubleToSmi(value)));
1964 } else { 1980 } else {
1965 ASSERT(to.IsInteger32()); 1981 ASSERT(to.IsInteger32());
1966 bool truncating = instr->CanTruncateToInt32(); 1982 bool truncating = instr->CanTruncateToInt32();
1967 bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3); 1983 bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3);
1968 LOperand* value = needs_temp ? 1984 LOperand* value = needs_temp ?
1969 UseTempRegister(instr->value()) : UseRegister(instr->value()); 1985 UseTempRegister(instr->value()) : UseRegister(instr->value());
1970 LOperand* temp = needs_temp ? TempRegister() : NULL; 1986 LOperand* temp = needs_temp ? TempRegister() : NULL;
1971 return AssignEnvironment( 1987 return AssignEnvironment(
1972 DefineAsRegister(new(zone()) LDoubleToI(value, temp))); 1988 DefineAsRegister(new(zone()) LDoubleToI(value, temp)));
1973 } 1989 }
1974 } else if (from.IsInteger32()) { 1990 } else if (from.IsInteger32()) {
1975 info()->MarkAsDeferredCalling(); 1991 info()->MarkAsDeferredCalling();
1976 if (to.IsTagged()) { 1992 if (to.IsTagged()) {
1977 HValue* val = instr->value(); 1993 HValue* val = instr->value();
1978 LOperand* value = UseRegister(val); 1994 LOperand* value = UseRegister(val);
1979 if (val->HasRange() && val->range()->IsInSmiRange()) { 1995 if (val->HasRange() && val->range()->IsInSmiRange()) {
1980 return DefineSameAsFirst(new(zone()) LSmiTag(value)); 1996 return DefineSameAsFirst(new(zone()) LSmiTag(value));
1981 } else if (val->CheckFlag(HInstruction::kUint32)) { 1997 } else if (val->CheckFlag(HInstruction::kUint32)) {
1982 LNumberTagU* result = new(zone()) LNumberTagU(value); 1998 LNumberTagU* result = new(zone()) LNumberTagU(value);
1983 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1999 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1984 } else { 2000 } else {
1985 LNumberTagI* result = new(zone()) LNumberTagI(value); 2001 LNumberTagI* result = new(zone()) LNumberTagI(value);
1986 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 2002 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1987 } 2003 }
2004 } else if (to.IsSmi()) {
2005 HValue* val = instr->value();
2006 LOperand* value = UseRegister(val);
2007 LInstruction* result =
2008 DefineSameAsFirst(new(zone()) LInteger32ToSmi(value));
2009 if (val->HasRange() && val->range()->IsInSmiRange()) {
2010 return result;
2011 }
2012 return AssignEnvironment(result);
1988 } else { 2013 } else {
1989 ASSERT(to.IsDouble()); 2014 ASSERT(to.IsDouble());
1990 if (instr->value()->CheckFlag(HInstruction::kUint32)) { 2015 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
1991 LOperand* temp = FixedTemp(xmm1); 2016 LOperand* temp = FixedTemp(xmm1);
1992 return DefineAsRegister( 2017 return DefineAsRegister(
1993 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp)); 2018 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp));
1994 } else { 2019 } else {
1995 return DefineAsRegister( 2020 return DefineAsRegister(
1996 new(zone()) LInteger32ToDouble(Use(instr->value()))); 2021 new(zone()) LInteger32ToDouble(Use(instr->value())));
1997 } 2022 }
(...skipping 20 matching lines...) Expand all
2018 2043
2019 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { 2044 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
2020 LUnallocated* temp = TempRegister(); 2045 LUnallocated* temp = TempRegister();
2021 LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp); 2046 LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp);
2022 return AssignEnvironment(result); 2047 return AssignEnvironment(result);
2023 } 2048 }
2024 2049
2025 2050
2026 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { 2051 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
2027 LOperand* value = UseAtStart(instr->value()); 2052 LOperand* value = UseAtStart(instr->value());
2028 return AssignEnvironment(new(zone()) LCheckSmi(value)); 2053 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
Jakob Kummerow 2013/05/23 12:49:31 This change causes unnecessary register pressure,
2029 } 2054 }
2030 2055
2031 2056
2032 LInstruction* LChunkBuilder::DoCheckSmiOrInt32(HCheckSmiOrInt32* instr) { 2057 LInstruction* LChunkBuilder::DoCheckSmiOrInt32(HCheckSmiOrInt32* instr) {
2033 LOperand* value = UseAtStart(instr->value()); 2058 LOperand* value = UseAtStart(instr->value());
2034 return AssignEnvironment(new(zone()) LCheckSmi(value)); 2059 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
2035 } 2060 }
2036 2061
2037 2062
2038 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) { 2063 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
2039 // If the target is in new space, we'll emit a global cell compare and so 2064 // If the target is in new space, we'll emit a global cell compare and so
2040 // want the value in a register. If the target gets promoted before we 2065 // want the value in a register. If the target gets promoted before we
2041 // emit code, we will still get the register but will do an immediate 2066 // emit code, we will still get the register but will do an immediate
2042 // compare instead of the cell compare. This is safe. 2067 // compare instead of the cell compare. This is safe.
2043 LOperand* value = instr->target_in_new_space() 2068 LOperand* value = instr->target_in_new_space()
2044 ? UseRegisterAtStart(instr->value()) : UseAtStart(instr->value()); 2069 ? UseRegisterAtStart(instr->value()) : UseAtStart(instr->value());
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
2759 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2784 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2760 LOperand* object = UseRegister(instr->object()); 2785 LOperand* object = UseRegister(instr->object());
2761 LOperand* index = UseTempRegister(instr->index()); 2786 LOperand* index = UseTempRegister(instr->index());
2762 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2787 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2763 } 2788 }
2764 2789
2765 2790
2766 } } // namespace v8::internal 2791 } } // namespace v8::internal
2767 2792
2768 #endif // V8_TARGET_ARCH_IA32 2793 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/lithium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698