| Index: runtime/vm/assembler_arm64.cc
|
| diff --git a/runtime/vm/assembler_arm64.cc b/runtime/vm/assembler_arm64.cc
|
| index 4fb6be32b9f143c9905f128f12435026a1459d73..b51c1bb8fa602d073c83521e23f3c5b1d58360bf 100644
|
| --- a/runtime/vm/assembler_arm64.cc
|
| +++ b/runtime/vm/assembler_arm64.cc
|
| @@ -1331,33 +1331,29 @@ void Assembler::TryAllocate(const Class& cls,
|
| // If this allocation is traced, program will jump to failure path
|
| // (i.e. the allocation stub) which will allocate the object and trace the
|
| // allocation call site.
|
| - MaybeTraceAllocation(cls.id(), temp_reg, pp, failure);
|
| + MaybeTraceAllocation(cls.id(), temp_reg, pp, failure,
|
| + /* inline_isolate = */ false);
|
| const intptr_t instance_size = cls.instance_size();
|
| - Heap* heap = Isolate::Current()->heap();
|
| - Heap::Space space = heap->SpaceForAllocation(cls.id());
|
| - const uword top_address = heap->TopAddress(space);
|
| - LoadImmediate(temp_reg, top_address, pp);
|
| - ldr(instance_reg, Address(temp_reg));
|
| + Heap::Space space = Heap::SpaceForAllocation(cls.id());
|
| + ldr(temp_reg, Address(THR, Thread::heap_offset()));
|
| + ldr(instance_reg, Address(temp_reg, Heap::TopOffset(space)));
|
| // TODO(koda): Protect against unsigned overflow here.
|
| AddImmediateSetFlags(instance_reg, instance_reg, instance_size, pp);
|
|
|
| // instance_reg: potential next object start.
|
| - const uword end_address = heap->EndAddress(space);
|
| - ASSERT(top_address < end_address);
|
| - // Could use ldm to load (top, end), but no benefit seen experimentally.
|
| - ldr(TMP, Address(temp_reg, end_address - top_address));
|
| + ldr(TMP, Address(temp_reg, Heap::EndOffset(space)));
|
| CompareRegisters(TMP, instance_reg);
|
| // fail if heap end unsigned less than or equal to instance_reg.
|
| b(failure, LS);
|
|
|
| // Successfully allocated the object, now update top to point to
|
| // next object start and store the class in the class field of object.
|
| - str(instance_reg, Address(temp_reg));
|
| + str(instance_reg, Address(temp_reg, Heap::TopOffset(space)));
|
|
|
| ASSERT(instance_size >= kHeapObjectTag);
|
| AddImmediate(
|
| instance_reg, instance_reg, -instance_size + kHeapObjectTag, pp);
|
| - UpdateAllocationStats(cls.id(), pp, space);
|
| + UpdateAllocationStats(cls.id(), pp, space, /* inline_isolate = */ false);
|
|
|
| uword tags = 0;
|
| tags = RawObject::SizeTag::update(instance_size, tags);
|
| @@ -1382,29 +1378,28 @@ void Assembler::TryAllocateArray(intptr_t cid,
|
| // If this allocation is traced, program will jump to failure path
|
| // (i.e. the allocation stub) which will allocate the object and trace the
|
| // allocation call site.
|
| - MaybeTraceAllocation(cid, temp1, PP, failure);
|
| - Isolate* isolate = Isolate::Current();
|
| - Heap* heap = isolate->heap();
|
| - Heap::Space space = heap->SpaceForAllocation(cid);
|
| - LoadImmediate(temp1, heap->TopAddress(space), PP);
|
| - ldr(instance, Address(temp1, 0)); // Potential new object start.
|
| + MaybeTraceAllocation(cid, temp1, PP, failure, /* inline_isolate = */ false);
|
| + Heap::Space space = Heap::SpaceForAllocation(cid);
|
| + ldr(temp1, Address(THR, Thread::heap_offset()));
|
| + // Potential new object start.
|
| + ldr(instance, Address(temp1, Heap::TopOffset(space)));
|
| AddImmediateSetFlags(end_address, instance, instance_size, PP);
|
| b(failure, CS); // Fail on unsigned overflow.
|
|
|
| // Check if the allocation fits into the remaining space.
|
| // instance: potential new object start.
|
| // end_address: potential next object start.
|
| - LoadImmediate(temp2, heap->EndAddress(space), PP);
|
| - ldr(temp2, Address(temp2, 0));
|
| + ldr(temp2, Address(temp1, Heap::EndOffset(space)));
|
| cmp(end_address, Operand(temp2));
|
| b(failure, CS);
|
|
|
| // Successfully allocated the object(s), now update top to point to
|
| // next object start and initialize the object.
|
| - str(end_address, Address(temp1, 0));
|
| + str(end_address, Address(temp1, Heap::TopOffset(space)));
|
| add(instance, instance, Operand(kHeapObjectTag));
|
| LoadImmediate(temp2, instance_size, PP);
|
| - UpdateAllocationStatsWithSize(cid, temp2, PP, space);
|
| + UpdateAllocationStatsWithSize(cid, temp2, PP, space,
|
| + /* inline_isolate = */ false);
|
|
|
| // Initialize the tags.
|
| // instance: new object start as a tagged pointer.
|
|
|