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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 15564004: Refactor the IL for object allocation with type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_ia32.cc
===================================================================
--- runtime/vm/intermediate_language_ia32.cc (revision 22932)
+++ runtime/vm/intermediate_language_ia32.cc (working copy)
@@ -1828,37 +1828,19 @@
LocationSummary*
AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const {
- const intptr_t kNumInputs = 2;
- const intptr_t kNumTemps = 0;
- LocationSummary* locs =
- new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
- locs->set_in(0, Location::RegisterLocation(EAX));
- locs->set_in(1, Location::RegisterLocation(ECX));
- locs->set_out(Location::RegisterLocation(EAX));
- return locs;
+ return MakeCallSummary();
}
void AllocateObjectWithBoundsCheckInstr::EmitNativeCode(
FlowGraphCompiler* compiler) {
- const Class& cls = Class::ZoneHandle(constructor().Owner());
- Register type_arguments = locs()->in(0).reg();
- Register instantiator_type_arguments = locs()->in(1).reg();
- Register result = locs()->out().reg();
-
- // Push the result place holder initialized to NULL.
- __ PushObject(Object::ZoneHandle());
- __ PushObject(cls);
- __ pushl(type_arguments);
- __ pushl(instantiator_type_arguments);
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kAllocateObjectWithBoundsCheckRuntimeEntry,
locs());
- // Pop instantiator type arguments, type arguments, and class.
- // source location.
__ Drop(3);
- __ popl(result); // Pop new instance.
+ ASSERT(locs()->out().reg() == EAX);
+ __ popl(EAX); // Pop new instance.
}
@@ -1953,14 +1935,12 @@
// If the instantiator is null and if the type argument vector
// instantiated from null becomes a vector of dynamic, then use null as
// the type arguments.
+ ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
Label type_arguments_instantiated;
- const intptr_t len = type_arguments().Length();
- if (type_arguments().IsRawInstantiatedRaw(len)) {
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- __ cmpl(instantiator_reg, raw_null);
- __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
- }
+ const Immediate& raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ __ cmpl(instantiator_reg, raw_null);
+ __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
// Instantiate non-null type arguments.
// In the non-factory case, we rely on the allocation stub to
// instantiate the type arguments.
@@ -1998,19 +1978,17 @@
// If the instantiator is null and if the type argument vector
// instantiated from null becomes a vector of dynamic, then use null as
// the type arguments and do not pass the instantiator.
- const intptr_t len = type_arguments().Length();
- if (type_arguments().IsRawInstantiatedRaw(len)) {
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- Label instantiator_not_null;
- __ cmpl(instantiator_reg, raw_null);
- __ j(NOT_EQUAL, &instantiator_not_null, Assembler::kNearJump);
- // Null was used in VisitExtractConstructorTypeArguments as the
- // instantiated type arguments, no proper instantiator needed.
- __ movl(instantiator_reg,
- Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
- __ Bind(&instantiator_not_null);
- }
+ ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
+ const Immediate& raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ Label instantiator_not_null;
+ __ cmpl(instantiator_reg, raw_null);
+ __ j(NOT_EQUAL, &instantiator_not_null, Assembler::kNearJump);
+ // Null was used in VisitExtractConstructorTypeArguments as the
+ // instantiated type arguments, no proper instantiator needed.
+ __ movl(instantiator_reg,
+ Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
+ __ Bind(&instantiator_not_null);
// instantiator_reg: instantiator or kNoInstantiator.
}

Powered by Google App Engine
This is Rietveld 408576698