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

Unified Diff: runtime/vm/assembler_x64.cc

Issue 1263513002: VM: Load allocation-top and -end via Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: arm, arm64 and mips Created 5 years, 5 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/assembler_x64.cc
diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc
index c397a13bc3c3d0a763600684ebdbb98cc6d23c45..125954aa62db6c42ccfafaf9c904429e1db0dffd 100644
--- a/runtime/vm/assembler_x64.cc
+++ b/runtime/vm/assembler_x64.cc
@@ -3522,28 +3522,27 @@ void Assembler::TryAllocate(const Class& cls,
Label* failure,
bool near_jump,
Register instance_reg,
- Register pp) {
+ Register pp,
+ Register temp) {
ASSERT(failure != NULL);
if (FLAG_inline_alloc) {
// 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(), failure, near_jump);
- Heap* heap = Isolate::Current()->heap();
+ MaybeTraceAllocation(cls.id(), failure, near_jump,
+ /* inline_isolate = */ false);
const intptr_t instance_size = cls.instance_size();
- Heap::Space space = heap->SpaceForAllocation(cls.id());
- LoadImmediate(TMP, Immediate(heap->TopAddress(space)), pp);
- movq(instance_reg, Address(TMP, 0));
+ Heap::Space space = Heap::SpaceForAllocation(cls.id());
+ movq(temp, Address(THR, Thread::heap_offset()));
+ movq(instance_reg, Address(temp, Heap::TopOffset(space)));
AddImmediate(instance_reg, Immediate(instance_size), pp);
// instance_reg: potential next object start.
- LoadImmediate(TMP, Immediate(heap->EndAddress(space)), pp);
- cmpq(instance_reg, Address(TMP, 0));
+ cmpq(instance_reg, Address(temp, Heap::EndOffset(space)));
j(ABOVE_EQUAL, failure, near_jump);
// Successfully allocated the object, now update top to point to
// next object start and store the class in the class field of object.
- LoadImmediate(TMP, Immediate(heap->TopAddress(space)), pp);
- movq(Address(TMP, 0), instance_reg);
- UpdateAllocationStats(cls.id(), space);
+ movq(Address(temp, Heap::TopOffset(space)), instance_reg);
+ UpdateAllocationStats(cls.id(), space, /* inline_isolate = */ false);
ASSERT(instance_size >= kHeapObjectTag);
AddImmediate(instance_reg, Immediate(kHeapObjectTag - instance_size), pp);
uword tags = 0;
@@ -3563,19 +3562,18 @@ void Assembler::TryAllocateArray(intptr_t cid,
Label* failure,
bool near_jump,
Register instance,
- Register end_address) {
+ Register end_address,
+ Register temp) {
ASSERT(failure != NULL);
if (FLAG_inline_alloc) {
// 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, failure, near_jump);
- Isolate* isolate = Isolate::Current();
- Heap* heap = isolate->heap();
- Heap::Space space = heap->SpaceForAllocation(cid);
- movq(instance, Immediate(heap->TopAddress(space)));
- movq(instance, Address(instance, 0));
- movq(end_address, RAX);
+ MaybeTraceAllocation(cid, failure, near_jump, /* inline_isolate = */ false);
+ Heap::Space space = Heap::SpaceForAllocation(cid);
+ movq(temp, Address(THR, Thread::heap_offset()));
+ movq(instance, Address(temp, Heap::TopOffset(space)));
+ movq(end_address, instance);
addq(end_address, Immediate(instance_size));
j(CARRY, failure);
@@ -3583,16 +3581,15 @@ void Assembler::TryAllocateArray(intptr_t cid,
// Check if the allocation fits into the remaining space.
// instance: potential new object start.
// end_address: potential next object start.
- movq(TMP, Immediate(heap->EndAddress(space)));
- cmpq(end_address, Address(TMP, 0));
+ cmpq(end_address, Address(temp, Heap::EndOffset(space)));
j(ABOVE_EQUAL, failure);
// Successfully allocated the object(s), now update top to point to
// next object start and initialize the object.
- movq(TMP, Immediate(heap->TopAddress(space)));
- movq(Address(TMP, 0), end_address);
+ movq(Address(temp, Heap::TopOffset(space)), end_address);
addq(instance, Immediate(kHeapObjectTag));
- UpdateAllocationStatsWithSize(cid, instance_size, space);
+ UpdateAllocationStatsWithSize(cid, instance_size, space,
+ /* inline_isolate = */ false);
// Initialize the tags.
// instance: new object start as a tagged pointer.

Powered by Google App Engine
This is Rietveld 408576698