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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 1241863002: VM: Refactor allocation stats code and remove duplicate code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments 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
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_ia32.cc
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 3addb330fba30198b9974b71d3897ad10c41b81e..32505f36de9041d461022829e17b5e69d6cb4769 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -623,7 +623,7 @@ void StubCode::GeneratePatchableAllocateArrayStub(Assembler* assembler,
Heap* heap = isolate->heap();
const intptr_t cid = kArrayCid;
- Heap::Space space = heap->SpaceForAllocation(cid);
+ Heap::Space space = Heap::SpaceForAllocation(cid);
__ movl(EAX, Address::Absolute(heap->TopAddress(space)));
__ movl(EBX, EAX);
@@ -841,8 +841,6 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
Immediate(reinterpret_cast<intptr_t>(Object::null()));
if (FLAG_inline_alloc) {
Label slow_case;
- Isolate* isolate = Isolate::Current();
- Heap* heap = isolate->heap();
// First compute the rounded instance size.
// EDX: number of context variables.
intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1);
@@ -852,14 +850,16 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
// Now allocate the object.
// EDX: number of context variables.
const intptr_t cid = kContextCid;
- Heap::Space space = heap->SpaceForAllocation(cid);
- __ movl(EAX, Address::Absolute(heap->TopAddress(space)));
+ Heap::Space space = Heap::SpaceForAllocation(cid);
+ __ LoadIsolate(ECX);
+ __ movl(ECX, Address(ECX, Isolate::heap_offset()));
+ __ movl(EAX, Address(ECX, Heap::TopOffset(space)));
__ addl(EBX, EAX);
// Check if the allocation fits into the remaining space.
// EAX: potential new object.
// EBX: potential next object start.
// EDX: number of context variables.
- __ cmpl(EBX, Address::Absolute(heap->EndAddress(space)));
+ __ cmpl(EBX, Address(ECX, Heap::EndOffset(space)));
if (FLAG_use_slow_path) {
__ jmp(&slow_case);
} else {
@@ -876,11 +876,13 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
// EAX: new object.
// EBX: next object start.
// EDX: number of context variables.
- __ movl(Address::Absolute(heap->TopAddress(space)), EBX);
+ __ movl(Address(ECX, Heap::TopOffset(space)), EBX);
__ addl(EAX, Immediate(kHeapObjectTag));
// EBX: Size of allocation in bytes.
__ subl(EBX, EAX);
- __ UpdateAllocationStatsWithSize(cid, EBX, kNoRegister, space);
+ // Generate isolate-independent code to allow sharing between isolates.
+ __ UpdateAllocationStatsWithSize(cid, EBX, EDI, space,
+ /* inline_isolate = */ false);
// Calculate the size tag.
// EAX: new object.
@@ -1065,7 +1067,7 @@ void StubCode::GenerateAllocationStubForClass(
// next object start and initialize the allocated object.
// EDX: instantiated type arguments (if is_cls_parameterized).
Heap* heap = Isolate::Current()->heap();
- Heap::Space space = heap->SpaceForAllocation(cls.id());
+ Heap::Space space = Heap::SpaceForAllocation(cls.id());
__ movl(EAX, Address::Absolute(heap->TopAddress(space)));
__ leal(EBX, Address(EAX, instance_size));
// Check if the allocation fits into the remaining space.
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698