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

Side by Side Diff: runtime/vm/intermediate_language_x64.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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 1922
1923 1923
1924 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( 1924 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode(
1925 FlowGraphCompiler* compiler) { 1925 FlowGraphCompiler* compiler) {
1926 Register instantiator_reg = locs()->in(0).reg(); 1926 Register instantiator_reg = locs()->in(0).reg();
1927 Register result_reg = locs()->out().reg(); 1927 Register result_reg = locs()->out().reg();
1928 ASSERT(instantiator_reg == result_reg); 1928 ASSERT(instantiator_reg == result_reg);
1929 1929
1930 // instantiator_reg is the instantiator type argument vector, i.e. an 1930 // instantiator_reg is the instantiator type argument vector, i.e. an
1931 // AbstractTypeArguments object (or null). 1931 // AbstractTypeArguments object (or null).
1932 if (!type_arguments().IsUninstantiatedIdentity() && 1932 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
1933 !type_arguments().CanShareInstantiatorTypeArguments( 1933 !type_arguments().CanShareInstantiatorTypeArguments(
1934 instantiator_class())) { 1934 instantiator_class()));
1935 // If the instantiator is null and if the type argument vector 1935 // If the instantiator is null and if the type argument vector
1936 // instantiated from null becomes a vector of dynamic, then use null as 1936 // instantiated from null becomes a vector of dynamic, then use null as
1937 // the type arguments. 1937 // the type arguments.
1938 Label type_arguments_instantiated; 1938 Label type_arguments_instantiated;
1939 const intptr_t len = type_arguments().Length(); 1939 const intptr_t len = type_arguments().Length();
1940 if (type_arguments().IsRawInstantiatedRaw(len)) { 1940 if (type_arguments().IsRawInstantiatedRaw(len)) {
1941 const Immediate& raw_null = 1941 const Immediate& raw_null =
1942 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1942 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1943 __ cmpq(instantiator_reg, raw_null); 1943 __ cmpq(instantiator_reg, raw_null);
1944 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); 1944 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
1945 }
1946 // Instantiate non-null type arguments.
1947 // In the non-factory case, we rely on the allocation stub to
1948 // instantiate the type arguments.
1949 __ LoadObject(result_reg, type_arguments());
1950 // result_reg: uninstantiated type arguments.
1951 __ Bind(&type_arguments_instantiated);
1952 } 1945 }
1953 ASSERT(instantiator_reg == result_reg); 1946 // Instantiate non-null type arguments.
1947 // In the non-factory case, we rely on the allocation stub to
1948 // instantiate the type arguments.
1949 __ LoadObject(result_reg, type_arguments());
1950 // result_reg: uninstantiated type arguments.
1951
1952 __ Bind(&type_arguments_instantiated);
1954 // result_reg: uninstantiated or instantiated type arguments. 1953 // result_reg: uninstantiated or instantiated type arguments.
1955 } 1954 }
1956 1955
1957 1956
1958 LocationSummary* 1957 LocationSummary*
1959 ExtractConstructorInstantiatorInstr::MakeLocationSummary() const { 1958 ExtractConstructorInstantiatorInstr::MakeLocationSummary() const {
1960 const intptr_t kNumInputs = 1; 1959 const intptr_t kNumInputs = 1;
1961 const intptr_t kNumTemps = 0; 1960 const intptr_t kNumTemps = 0;
1962 LocationSummary* locs = 1961 LocationSummary* locs =
1963 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1962 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1964 locs->set_in(0, Location::RequiresRegister()); 1963 locs->set_in(0, Location::RequiresRegister());
1965 locs->set_out(Location::SameAsFirstInput()); 1964 locs->set_out(Location::SameAsFirstInput());
1966 return locs; 1965 return locs;
1967 } 1966 }
1968 1967
1969 1968
1970 void ExtractConstructorInstantiatorInstr::EmitNativeCode( 1969 void ExtractConstructorInstantiatorInstr::EmitNativeCode(
1971 FlowGraphCompiler* compiler) { 1970 FlowGraphCompiler* compiler) {
1972 Register instantiator_reg = locs()->in(0).reg(); 1971 Register instantiator_reg = locs()->in(0).reg();
1973 ASSERT(locs()->out().reg() == instantiator_reg); 1972 ASSERT(locs()->out().reg() == instantiator_reg);
1974 1973
1975 // instantiator_reg is the instantiator AbstractTypeArguments object 1974 // instantiator_reg is the instantiator AbstractTypeArguments object
1976 // (or null). 1975 // (or null).
1977 if (type_arguments().IsUninstantiatedIdentity() || 1976 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
1978 type_arguments().CanShareInstantiatorTypeArguments( 1977 !type_arguments().CanShareInstantiatorTypeArguments(
1979 instantiator_class())) { 1978 instantiator_class()));
1980 // The instantiator was used in VisitExtractConstructorTypeArguments as the 1979
1980 // If the instantiator is null and if the type argument vector
1981 // instantiated from null becomes a vector of dynamic, then use null as
1982 // the type arguments and do not pass the instantiator.
1983 const intptr_t len = type_arguments().Length();
1984 if (type_arguments().IsRawInstantiatedRaw(len)) {
1985 const Immediate& raw_null =
1986 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1987 Label instantiator_not_null;
1988 __ cmpq(instantiator_reg, raw_null);
1989 __ j(NOT_EQUAL, &instantiator_not_null, Assembler::kNearJump);
1990 // Null was used in VisitExtractConstructorTypeArguments as the
1981 // instantiated type arguments, no proper instantiator needed. 1991 // instantiated type arguments, no proper instantiator needed.
1982 __ movq(instantiator_reg, 1992 __ movq(instantiator_reg,
1983 Immediate(Smi::RawValue(StubCode::kNoInstantiator))); 1993 Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
1984 } else { 1994 __ Bind(&instantiator_not_null);
1985 // If the instantiator is null and if the type argument vector
1986 // instantiated from null becomes a vector of dynamic, then use null as
1987 // the type arguments and do not pass the instantiator.
1988 const intptr_t len = type_arguments().Length();
1989 if (type_arguments().IsRawInstantiatedRaw(len)) {
1990 const Immediate& raw_null =
1991 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1992 Label instantiator_not_null;
1993 __ cmpq(instantiator_reg, raw_null);
1994 __ j(NOT_EQUAL, &instantiator_not_null, Assembler::kNearJump);
1995 // Null was used in VisitExtractConstructorTypeArguments as the
1996 // instantiated type arguments, no proper instantiator needed.
1997 __ movq(instantiator_reg,
1998 Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
1999 __ Bind(&instantiator_not_null);
2000 }
2001 } 1995 }
2002 // instantiator_reg: instantiator or kNoInstantiator. 1996 // instantiator_reg: instantiator or kNoInstantiator.
2003 } 1997 }
2004 1998
2005 1999
2006 LocationSummary* AllocateContextInstr::MakeLocationSummary() const { 2000 LocationSummary* AllocateContextInstr::MakeLocationSummary() const {
2007 const intptr_t kNumInputs = 0; 2001 const intptr_t kNumInputs = 0;
2008 const intptr_t kNumTemps = 1; 2002 const intptr_t kNumTemps = 1;
2009 LocationSummary* locs = 2003 LocationSummary* locs =
2010 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 2004 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
(...skipping 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after
4350 PcDescriptors::kOther, 4344 PcDescriptors::kOther,
4351 locs()); 4345 locs());
4352 __ Drop(2); // Discard type arguments and receiver. 4346 __ Drop(2); // Discard type arguments and receiver.
4353 } 4347 }
4354 4348
4355 } // namespace dart 4349 } // namespace dart
4356 4350
4357 #undef __ 4351 #undef __
4358 4352
4359 #endif // defined TARGET_ARCH_X64 4353 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/intermediate_language_arm.cc ('K') | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698