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

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

Issue 14672035: Further improve and simplify IL for building constructor type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased 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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 1940
1941 1941
1942 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( 1942 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode(
1943 FlowGraphCompiler* compiler) { 1943 FlowGraphCompiler* compiler) {
1944 Register instantiator_reg = locs()->in(0).reg(); 1944 Register instantiator_reg = locs()->in(0).reg();
1945 Register result_reg = locs()->out().reg(); 1945 Register result_reg = locs()->out().reg();
1946 ASSERT(instantiator_reg == result_reg); 1946 ASSERT(instantiator_reg == result_reg);
1947 1947
1948 // instantiator_reg is the instantiator type argument vector, i.e. an 1948 // instantiator_reg is the instantiator type argument vector, i.e. an
1949 // AbstractTypeArguments object (or null). 1949 // AbstractTypeArguments object (or null).
1950 if (!type_arguments().IsUninstantiatedIdentity() && 1950 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
1951 !type_arguments().CanShareInstantiatorTypeArguments( 1951 !type_arguments().CanShareInstantiatorTypeArguments(
1952 instantiator_class())) { 1952 instantiator_class()));
1953 // If the instantiator is null and if the type argument vector 1953 // If the instantiator is null and if the type argument vector
1954 // instantiated from null becomes a vector of dynamic, then use null as 1954 // instantiated from null becomes a vector of dynamic, then use null as
1955 // the type arguments. 1955 // the type arguments.
1956 Label type_arguments_instantiated; 1956 Label type_arguments_instantiated;
1957 const intptr_t len = type_arguments().Length(); 1957 const intptr_t len = type_arguments().Length();
1958 if (type_arguments().IsRawInstantiatedRaw(len)) { 1958 if (type_arguments().IsRawInstantiatedRaw(len)) {
1959 const Immediate& raw_null = 1959 const Immediate& raw_null =
1960 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1960 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1961 __ cmpl(instantiator_reg, raw_null); 1961 __ cmpl(instantiator_reg, raw_null);
1962 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); 1962 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
1963 }
1964 // Instantiate non-null type arguments.
1965 // In the non-factory case, we rely on the allocation stub to
1966 // instantiate the type arguments.
1967 __ LoadObject(result_reg, type_arguments());
1968 // result_reg: uninstantiated type arguments.
1969 __ Bind(&type_arguments_instantiated);
1970 } 1963 }
1971 ASSERT(instantiator_reg == result_reg); 1964 // Instantiate non-null type arguments.
1965 // In the non-factory case, we rely on the allocation stub to
1966 // instantiate the type arguments.
1967 __ LoadObject(result_reg, type_arguments());
1968 // result_reg: uninstantiated type arguments.
1969
1970 __ Bind(&type_arguments_instantiated);
1972 // result_reg: uninstantiated or instantiated type arguments. 1971 // result_reg: uninstantiated or instantiated type arguments.
1973 } 1972 }
1974 1973
1975 1974
1976 LocationSummary* 1975 LocationSummary*
1977 ExtractConstructorInstantiatorInstr::MakeLocationSummary() const { 1976 ExtractConstructorInstantiatorInstr::MakeLocationSummary() const {
1978 const intptr_t kNumInputs = 1; 1977 const intptr_t kNumInputs = 1;
1979 const intptr_t kNumTemps = 0; 1978 const intptr_t kNumTemps = 0;
1980 LocationSummary* locs = 1979 LocationSummary* locs =
1981 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1980 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1982 locs->set_in(0, Location::RequiresRegister()); 1981 locs->set_in(0, Location::RequiresRegister());
1983 locs->set_out(Location::SameAsFirstInput()); 1982 locs->set_out(Location::SameAsFirstInput());
1984 return locs; 1983 return locs;
1985 } 1984 }
1986 1985
1987 1986
1988 void ExtractConstructorInstantiatorInstr::EmitNativeCode( 1987 void ExtractConstructorInstantiatorInstr::EmitNativeCode(
1989 FlowGraphCompiler* compiler) { 1988 FlowGraphCompiler* compiler) {
1990 Register instantiator_reg = locs()->in(0).reg(); 1989 Register instantiator_reg = locs()->in(0).reg();
1991 ASSERT(locs()->out().reg() == instantiator_reg); 1990 ASSERT(locs()->out().reg() == instantiator_reg);
1992 1991
1993 // instantiator_reg is the instantiator AbstractTypeArguments object 1992 // instantiator_reg is the instantiator AbstractTypeArguments object
1994 // (or null). 1993 // (or null).
1995 if (type_arguments().IsUninstantiatedIdentity() || 1994 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
1996 type_arguments().CanShareInstantiatorTypeArguments( 1995 !type_arguments().CanShareInstantiatorTypeArguments(
1997 instantiator_class())) { 1996 instantiator_class()));
1998 // The instantiator was used in VisitExtractConstructorTypeArguments as the 1997
1998 // If the instantiator is null and if the type argument vector
1999 // instantiated from null becomes a vector of dynamic, then use null as
2000 // the type arguments and do not pass the instantiator.
2001 const intptr_t len = type_arguments().Length();
2002 if (type_arguments().IsRawInstantiatedRaw(len)) {
2003 const Immediate& raw_null =
2004 Immediate(reinterpret_cast<intptr_t>(Object::null()));
2005 Label instantiator_not_null;
2006 __ cmpl(instantiator_reg, raw_null);
2007 __ j(NOT_EQUAL, &instantiator_not_null, Assembler::kNearJump);
2008 // Null was used in VisitExtractConstructorTypeArguments as the
1999 // instantiated type arguments, no proper instantiator needed. 2009 // instantiated type arguments, no proper instantiator needed.
2000 __ movl(instantiator_reg, 2010 __ movl(instantiator_reg,
2001 Immediate(Smi::RawValue(StubCode::kNoInstantiator))); 2011 Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
2002 } else { 2012 __ Bind(&instantiator_not_null);
2003 // If the instantiator is null and if the type argument vector
2004 // instantiated from null becomes a vector of dynamic, then use null as
2005 // the type arguments and do not pass the instantiator.
2006 const intptr_t len = type_arguments().Length();
2007 if (type_arguments().IsRawInstantiatedRaw(len)) {
2008 const Immediate& raw_null =
2009 Immediate(reinterpret_cast<intptr_t>(Object::null()));
2010 Label instantiator_not_null;
2011 __ cmpl(instantiator_reg, raw_null);
2012 __ j(NOT_EQUAL, &instantiator_not_null, Assembler::kNearJump);
2013 // Null was used in VisitExtractConstructorTypeArguments as the
2014 // instantiated type arguments, no proper instantiator needed.
2015 __ movl(instantiator_reg,
2016 Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
2017 __ Bind(&instantiator_not_null);
2018 }
2019 } 2013 }
2020 // instantiator_reg: instantiator or kNoInstantiator. 2014 // instantiator_reg: instantiator or kNoInstantiator.
2021 } 2015 }
2022 2016
2023 2017
2024 LocationSummary* AllocateContextInstr::MakeLocationSummary() const { 2018 LocationSummary* AllocateContextInstr::MakeLocationSummary() const {
2025 const intptr_t kNumInputs = 0; 2019 const intptr_t kNumInputs = 0;
2026 const intptr_t kNumTemps = 1; 2020 const intptr_t kNumTemps = 1;
2027 LocationSummary* locs = 2021 LocationSummary* locs =
2028 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2022 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
(...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after
4707 PcDescriptors::kOther, 4701 PcDescriptors::kOther,
4708 locs()); 4702 locs());
4709 __ Drop(2); // Discard type arguments and receiver. 4703 __ Drop(2); // Discard type arguments and receiver.
4710 } 4704 }
4711 4705
4712 } // namespace dart 4706 } // namespace dart
4713 4707
4714 #undef __ 4708 #undef __
4715 4709
4716 #endif // defined TARGET_ARCH_IA32 4710 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698