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

Unified Diff: runtime/vm/stub_code_arm.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.h ('k') | runtime/vm/stub_code_arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_arm.cc
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index 133793498d47502fab1a65b4a325bf9fcfb835ca..5d270cee35affb6b3f463fed9e793b2207358f2b 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -665,7 +665,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);
__ LoadImmediate(R6, heap->TopAddress(space));
__ ldr(R0, Address(R6, 0)); // Potential new object start.
__ adds(R7, R0, Operand(R9)); // Potential next object start.
@@ -730,7 +730,7 @@ void StubCode::GeneratePatchableAllocateArrayStub(Assembler* assembler,
__ mov(R5, Operand(R4));
__ AddImmediate(R6, R0, sizeof(RawArray) - kHeapObjectTag);
__ InitializeFieldsNoBarrier(R0, R6, R7, R4, R5);
- __ IncrementAllocationStatsWithSize(R3, R9, cid, space);
+ __ IncrementAllocationStatsWithSize(R3, R9, space);
__ Ret(); // Returns the newly allocated object in R0.
// Unable to allocate the array using the fast inline code, just call
// into the runtime.
@@ -878,7 +878,6 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
if (FLAG_inline_alloc) {
Label slow_case;
- Heap* heap = Isolate::Current()->heap();
// First compute the rounded instance size.
// R1: number of context variables.
intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1;
@@ -891,18 +890,18 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
// R1: number of context variables.
// R2: object size.
const intptr_t cid = kContextCid;
- Heap::Space space = heap->SpaceForAllocation(cid);
- __ LoadImmediate(R5, heap->TopAddress(space));
- __ ldr(R0, Address(R5, 0));
+ Heap::Space space = Heap::SpaceForAllocation(cid);
+ __ LoadIsolate(R5);
+ __ ldr(R5, Address(R5, Isolate::heap_offset()));
+ __ ldr(R0, Address(R5, Heap::TopOffset(space)));
__ add(R3, R2, Operand(R0));
// Check if the allocation fits into the remaining space.
// R0: potential new object.
// R1: number of context variables.
// R2: object size.
// R3: potential next object start.
- // R5: top address.
- __ LoadImmediate(IP, heap->EndAddress(space));
- __ ldr(IP, Address(IP, 0));
+ // R5: heap.
+ __ ldr(IP, Address(R5, Heap::EndOffset(space)));
__ cmp(R3, Operand(IP));
if (FLAG_use_slow_path) {
__ b(&slow_case);
@@ -916,9 +915,9 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
// R1: number of context variables.
// R2: object size.
// R3: next object start.
- // R5: top address.
- __ LoadAllocationStatsAddress(R6, cid);
- __ str(R3, Address(R5, 0));
+ // R5: heap.
+ __ LoadAllocationStatsAddress(R6, cid, /* inline_isolate = */ false);
+ __ str(R3, Address(R5, Heap::TopOffset(space)));
__ add(R0, R0, Operand(kHeapObjectTag));
// Calculate the size tag.
@@ -967,7 +966,7 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
Label loop;
__ AddImmediate(R7, R0, Context::variable_offset(0) - kHeapObjectTag);
__ InitializeFieldsNoBarrier(R0, R7, R3, R4, R5);
- __ IncrementAllocationStatsWithSize(R6, R2, cid, space);
+ __ IncrementAllocationStatsWithSize(R6, R2, space);
// Done allocating and initializing the context.
// R0: new object.
@@ -1093,7 +1092,7 @@ void StubCode::GenerateAllocationStubForClass(
// Allocate the object and update top to point to
// next object start and initialize the allocated object.
Heap* heap = Isolate::Current()->heap();
- Heap::Space space = heap->SpaceForAllocation(cls.id());
+ Heap::Space space = Heap::SpaceForAllocation(cls.id());
__ LoadImmediate(R5, heap->TopAddress(space));
__ ldr(R0, Address(R5, 0));
__ AddImmediate(R1, R0, instance_size);
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/stub_code_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698