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

Unified Diff: runtime/vm/stub_code_arm64.cc

Issue 578443003: Support old-space allocation in generated code (bump block only for now). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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/stub_code_arm64.cc
===================================================================
--- runtime/vm/stub_code_arm64.cc (revision 40250)
+++ runtime/vm/stub_code_arm64.cc (working copy)
@@ -657,16 +657,22 @@
}
__ cmp(R2, Operand(0));
__ b(&slow_case, LT);
- __ LoadFieldFromOffset(R8, CTX, Context::isolate_offset(), kNoPP);
- __ LoadFromOffset(R8, R8, Isolate::heap_offset(), kNoPP);
- __ LoadFromOffset(R8, R8, Heap::new_space_offset(), kNoPP);
+ Isolate* isolate = Isolate::Current();
+ Heap* heap = isolate->heap();
+ Heap::Space space = heap->SpaceForAllocation(kArrayCid);
+ const uword top_address = heap->TopAddress(space);
+ __ LoadImmediate(R8, top_address, kNoPP);
+ const uword end_address = heap->EndAddress(space);
+ ASSERT(top_address < end_address);
+ const uword top_offset = 0;
+ const uword end_offset = end_address - top_address;
// Calculate and align allocation size.
// Load new object start and calculate next object start.
// R1: array element type.
// R2: array length as Smi.
// R8: points to new space object.
- __ LoadFromOffset(R0, R8, Scavenger::top_offset(), kNoPP);
+ __ LoadFromOffset(R0, R8, top_offset, kNoPP);
intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1;
__ LoadImmediate(R3, fixed_size, kNoPP);
__ add(R3, R3, Operand(R2, LSL, 2)); // R2 is Smi.
@@ -682,7 +688,7 @@
// R3: array size.
// R7: potential next object start.
// R8: points to new space object.
- __ LoadFromOffset(TMP, R8, Scavenger::end_offset(), kNoPP);
+ __ LoadFromOffset(TMP, R8, end_offset, kNoPP);
__ CompareRegisters(R7, TMP);
__ b(&slow_case, CS); // Branch if unsigned higher or equal.
@@ -692,9 +698,9 @@
// R3: array size.
// R7: potential next object start.
// R8: Points to new space object.
- __ StoreToOffset(R7, R8, Scavenger::top_offset(), kNoPP);
+ __ StoreToOffset(R7, R8, top_offset, kNoPP);
__ add(R0, R0, Operand(kHeapObjectTag));
- __ UpdateAllocationStatsWithSize(kArrayCid, R3, kNoPP);
+ __ UpdateAllocationStatsWithSize(kArrayCid, R3, kNoPP, space);
// R0: new object start as a tagged pointer.
// R1: array element type.
@@ -961,7 +967,9 @@
// Now allocate the object.
// R1: number of context variables.
// R2: object size.
- __ LoadImmediate(R5, heap->TopAddress(), kNoPP);
+ intptr_t cid = context_class.id();
+ Heap::Space space = heap->SpaceForAllocation(cid);
+ __ LoadImmediate(R5, heap->TopAddress(space), kNoPP);
__ ldr(R0, Address(R5));
__ add(R3, R2, Operand(R0));
// Check if the allocation fits into the remaining space.
@@ -969,7 +977,7 @@
// R1: number of context variables.
// R2: object size.
// R3: potential next object start.
- __ LoadImmediate(TMP, heap->EndAddress(), kNoPP);
+ __ LoadImmediate(TMP, heap->EndAddress(space), kNoPP);
__ ldr(TMP, Address(TMP));
__ CompareRegisters(R3, TMP);
if (FLAG_use_slow_path) {
@@ -986,7 +994,7 @@
// R3: next object start.
__ str(R3, Address(R5));
__ add(R0, R0, Operand(kHeapObjectTag));
- __ UpdateAllocationStatsWithSize(context_class.id(), R2, kNoPP);
+ __ UpdateAllocationStatsWithSize(cid, R2, kNoPP, space);
// Calculate the size tag.
// R0: new object.
@@ -1002,7 +1010,7 @@
// Get the class index and insert it into the tags.
// R2: size and bit tags.
__ LoadImmediate(
- TMP, RawObject::ClassIdTag::encode(context_class.id()), kNoPP);
+ TMP, RawObject::ClassIdTag::encode(cid), kNoPP);
__ orr(R2, R2, Operand(TMP));
__ StoreFieldToOffset(R2, R0, Context::tags_offset(), kNoPP);
@@ -1153,13 +1161,14 @@
// next object start and initialize the allocated object.
// R1: instantiated type arguments (if is_cls_parameterized).
Heap* heap = Isolate::Current()->heap();
- __ LoadImmediate(R5, heap->TopAddress(), kNoPP);
+ Heap::Space space = heap->SpaceForAllocation(cls.id());
+ __ LoadImmediate(R5, heap->TopAddress(space), kNoPP);
__ ldr(R2, Address(R5));
__ AddImmediate(R3, R2, instance_size, kNoPP);
// Check if the allocation fits into the remaining space.
// R2: potential new object start.
// R3: potential next object start.
- __ LoadImmediate(TMP, heap->EndAddress(), kNoPP);
+ __ LoadImmediate(TMP, heap->EndAddress(space), kNoPP);
__ ldr(TMP, Address(TMP));
__ CompareRegisters(R3, TMP);
if (FLAG_use_slow_path) {
@@ -1168,7 +1177,7 @@
__ b(&slow_case, CS); // Unsigned higher or equal.
}
__ str(R3, Address(R5));
- __ UpdateAllocationStats(cls.id(), kNoPP);
+ __ UpdateAllocationStats(cls.id(), kNoPP, space);
// R2: new object start.
// R3: next object start.

Powered by Google App Engine
This is Rietveld 408576698