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

Unified Diff: runtime/vm/stub_code_x64.cc

Issue 2974403002: Revert "Moves the top_ and end_ words of the Scavenger into mutator thread." (Closed)
Patch Set: Created 3 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
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_x64.cc
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 69bdf70da4e5123f93ddd9b266b7f8219e474a22..95874ca8b111a54cd24448d77a231aea04b7faa4 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -663,8 +663,9 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
__ andq(RDI, Immediate(-kObjectAlignment));
const intptr_t cid = kArrayCid;
- NOT_IN_PRODUCT(Heap::Space space = Heap::kNew);
- __ movq(RAX, Address(THR, Thread::top_offset()));
+ Heap::Space space = Heap::kNew;
+ __ movq(R13, Address(THR, Thread::heap_offset()));
+ __ movq(RAX, Address(R13, Heap::TopOffset(space)));
// RDI: allocation size.
__ movq(RCX, RAX);
@@ -675,12 +676,13 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
// RAX: potential new object start.
// RCX: potential next object start.
// RDI: allocation size.
- __ cmpq(RCX, Address(THR, Thread::end_offset()));
+ // R13: heap.
+ __ cmpq(RCX, Address(R13, Heap::EndOffset(space)));
__ j(ABOVE_EQUAL, &slow_case);
// Successfully allocated the object(s), now update top to point to
// next object start and initialize the object.
- __ movq(Address(THR, Thread::top_offset()), RCX);
+ __ movq(Address(R13, Heap::TopOffset(space)), RCX);
__ addq(RAX, Immediate(kHeapObjectTag));
NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space));
// Initialize the tags.
@@ -910,14 +912,16 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
// Now allocate the object.
// R10: number of context variables.
const intptr_t cid = kContextCid;
- NOT_IN_PRODUCT(Heap::Space space = Heap::kNew);
- __ movq(RAX, Address(THR, Thread::top_offset()));
+ Heap::Space space = Heap::kNew;
+ __ 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.
// RAX: potential new object.
// R13: potential next object start.
// R10: number of context variables.
- __ cmpq(R13, Address(THR, Thread::end_offset()));
+ // RCX: heap.
+ __ cmpq(R13, Address(RCX, Heap::EndOffset(space)));
if (FLAG_use_slow_path) {
__ jmp(&slow_case);
} else {
@@ -929,7 +933,8 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
// RAX: new object.
// R13: next object start.
// R10: number of context variables.
- __ movq(Address(THR, Thread::top_offset()), R13);
+ // RCX: heap.
+ __ movq(Address(RCX, Heap::TopOffset(space)), R13);
// R13: Size of allocation in bytes.
__ subq(R13, RAX);
__ addq(RAX, Immediate(kHeapObjectTag));
@@ -1108,19 +1113,21 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
// 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).
- NOT_IN_PRODUCT(Heap::Space space = Heap::kNew);
- __ movq(RAX, Address(THR, Thread::top_offset()));
+ Heap::Space space = Heap::kNew;
+ __ 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.
- __ cmpq(RBX, Address(THR, Thread::end_offset()));
+ // 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(THR, Thread::top_offset()), RBX);
+ __ movq(Address(RCX, Heap::TopOffset(space)), RBX);
NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space));
// RAX: new object start (untagged).
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698