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

Unified Diff: runtime/vm/stub_code_arm.cc

Issue 163683006: Simplify generated code for object allocation with type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 6 years, 10 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
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_arm.cc
===================================================================
--- runtime/vm/stub_code_arm.cc (revision 32653)
+++ runtime/vm/stub_code_arm.cc (working copy)
@@ -1097,8 +1097,7 @@
// Called for inline allocation of objects.
// Input parameters:
// LR : return address.
-// SP + 4 : type arguments object (only if class is parameterized).
-// SP + 0 : type arguments of instantiator (only if class is parameterized).
+// SP + 0 : type arguments object (only if class is parameterized).
void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
const Class& cls) {
// The generated code is different if the class is parameterized.
@@ -1115,42 +1114,12 @@
if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size)) {
Label slow_case_reload_type_arguments;
if (is_cls_parameterized) {
- // Instantiation of the type arguments vector is only required if an
- // instantiator is provided (not kNoInstantiator, but may be null).
- __ ldm(IA, SP, (1 << R0) | (1 << R1));
- // R1: type arguments, instantiated or not.
- // R0: instantiator type arguments or kNoInstantiator.
- Label type_arguments_ready;
- __ CompareImmediate(R0, Smi::RawValue(StubCode::kNoInstantiator));
- __ b(&type_arguments_ready, EQ);
- // Lookup instantiator R0 in instantiations array of type arguments R1
- // and, if found, use cached instantiated type arguments.
- __ ldr(R2, FieldAddress(R1, TypeArguments::instantiations_offset()));
- __ ldr(R3, FieldAddress(R2, Array::length_offset()));
- __ AddImmediate(R2, Array::data_offset() - kHeapObjectTag);
- __ add(R3, R2, ShifterOperand(R3, LSL, 1)); // R3 is Smi.
- Label loop, found;
- __ Bind(&loop);
- __ cmp(R2, ShifterOperand(R3));
- __ b(&slow_case_reload_type_arguments, CS); // Unsigned higher or equal.
- __ ldr(R1, Address(R2, 0 * kWordSize)); // Cached instantiator.
- __ cmp(R1, ShifterOperand(R0));
- __ b(&found, EQ);
- __ CompareImmediate(R1, Smi::RawValue(StubCode::kNoInstantiator));
- __ b(&slow_case_reload_type_arguments, EQ);
- __ AddImmediate(R2, 2 * kWordSize);
- __ b(&loop);
- __ Bind(&found);
- __ ldr(R1, Address(R2, 1 * kWordSize)); // Cached instantiated args.
- __ LoadImmediate(R0, Smi::RawValue(StubCode::kNoInstantiator));
- __ Bind(&type_arguments_ready);
+ __ ldr(R1, Address(SP, 0));
// R1: instantiated type arguments.
- // R0: kNoInstantiator.
}
// Allocate the object and update top to point to
// next object start and initialize the allocated object.
// R1: instantiated type arguments (if is_cls_parameterized).
- // R0: kNoInstantiator (if is_cls_parameterized).
Heap* heap = Isolate::Current()->heap();
__ LoadImmediate(R5, heap->TopAddress());
__ ldr(R2, Address(R5, 0));
@@ -1228,12 +1197,11 @@
__ Bind(&slow_case_reload_type_arguments);
}
if (is_cls_parameterized) {
- __ ldm(IA, SP, (1 << R0) | (1 << R1));
+ __ ldr(R1, Address(SP, 0));
}
__ Bind(&slow_case_with_type_arguments);
// If is_cls_parameterized:
- // R1: new object type arguments (instantiated or not).
- // R0: instantiator type arguments or kNoInstantiator.
+ // R1: new object type arguments.
// Create a stub frame as we are pushing some objects on the stack before
// calling into the runtime.
__ EnterStubFrame(true); // Uses pool pointer to pass cls to runtime.
@@ -1241,15 +1209,14 @@
__ Push(R2); // Setup space on stack for return value.
__ PushObject(cls); // Push class of object to be allocated.
if (is_cls_parameterized) {
- // Push type arguments of object to be allocated and of instantiator.
- __ PushList((1 << R0) | (1 << R1));
+ // Push type arguments.
+ __ Push(R1);
} else {
- // Push null type arguments and kNoInstantiator.
- __ LoadImmediate(R1, Smi::RawValue(StubCode::kNoInstantiator));
- __ PushList((1 << R1) | (1 << R2));
+ // Push null type arguments.
+ __ Push(R2);
}
- __ CallRuntime(kAllocateObjectRuntimeEntry, 3); // Allocate object.
- __ Drop(3); // Pop arguments.
+ __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object.
+ __ Drop(2); // Pop arguments.
__ Pop(R0); // Pop result (newly allocated object).
// R0: new object
// Restore the frame pointer.
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698