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

Unified Diff: runtime/vm/stub_code_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/stub_code_x64.cc
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index ba8caa245c809c787e331a319157988b8130dfb0..c4482674a6ac6de199356e83a04c6e52d2100a64 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -616,8 +616,7 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
const intptr_t cid = kArrayCid;
Heap::Space space = Heap::SpaceForAllocation(cid);
- __ LoadIsolate(R13);
- __ movq(R13, Address(R13, Isolate::heap_offset()));
+ __ movq(R13, Address(THR, Thread::heap_offset()));
__ movq(RAX, Address(R13, Heap::TopOffset(space)));
// RDI: allocation size.
@@ -865,8 +864,7 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
// R10: number of context variables.
const intptr_t cid = kContextCid;
Heap::Space space = Heap::SpaceForAllocation(cid);
- __ LoadIsolate(RCX);
- __ movq(RCX, Address(RCX, Isolate::heap_offset()));
+ __ movq(RCX, Address(THR, Thread::heap_offset()));
__ movq(RAX, Address(RCX, Heap::TopOffset(space)));
__ addq(R13, RAX);
// Check if the allocation fits into the remaining space.
@@ -1076,24 +1074,22 @@ void StubCode::GenerateAllocationStubForClass(
// Allocate the object and update top to point to
// next object start and initialize the allocated object.
// RDX: instantiated type arguments (if is_cls_parameterized).
- Heap* heap = Isolate::Current()->heap();
Heap::Space space = Heap::SpaceForAllocation(cls.id());
- __ movq(RCX, Immediate(heap->TopAddress(space)));
- __ movq(RAX, Address(RCX, 0));
+ __ movq(RCX, Address(THR, Thread::heap_offset()));
+ __ movq(RAX, Address(RCX, Heap::TopOffset(space)));
__ leaq(RBX, Address(RAX, instance_size));
// Check if the allocation fits into the remaining space.
// RAX: potential new object start.
// RBX: potential next object start.
- // RCX: heap top address.
- __ movq(R13, Immediate(heap->EndAddress(space)));
- __ cmpq(RBX, Address(R13, 0));
+ // RCX: heap.
+ __ cmpq(RBX, Address(RCX, Heap::EndOffset(space)));
if (FLAG_use_slow_path) {
__ jmp(&slow_case);
} else {
__ j(ABOVE_EQUAL, &slow_case);
}
- __ movq(Address(RCX, 0), RBX);
- __ UpdateAllocationStats(cls.id(), space);
+ __ movq(Address(RCX, Heap::TopOffset(space)), RBX);
+ __ UpdateAllocationStats(cls.id(), space, /* inline_isolate = */ false);
// RAX: new object start (untagged).
// RBX: next object start.

Powered by Google App Engine
This is Rietveld 408576698