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

Unified Diff: runtime/vm/assembler_mips.cc

Issue 1213013002: Update Assembler::TryAllocate to support inline allocation tracing (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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/assembler_mips.h ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_mips.cc
diff --git a/runtime/vm/assembler_mips.cc b/runtime/vm/assembler_mips.cc
index 3d56a04ddf383aad7d1fd54a287a5d147fa52114..3c8301f658cd4ae858c1d371e68980c19a679428 100644
--- a/runtime/vm/assembler_mips.cc
+++ b/runtime/vm/assembler_mips.cc
@@ -890,6 +890,33 @@ void Assembler::UpdateAllocationStatsWithSize(intptr_t cid,
}
+void Assembler::MaybeTraceAllocation(intptr_t cid,
+ Register temp_reg,
+ Label* trace) {
+ ASSERT(cid > 0);
+ ASSERT(!in_delay_slot_);
+ ASSERT(temp_reg != kNoRegister);
+ ASSERT(temp_reg != TMP);
+ Isolate* isolate = Isolate::Current();
+ ClassTable* class_table = isolate->class_table();
+ const uword class_offset = cid * sizeof(ClassHeapStats); // NOLINT
+ if (cid < kNumPredefinedCids) {
+ const uword class_heap_stats_table_address =
+ class_table->PredefinedClassHeapStatsTableAddress();
+ LoadImmediate(temp_reg, class_heap_stats_table_address + class_offset);
+ } else {
+ LoadImmediate(temp_reg, class_table->ClassStatsTableAddress());
+ lw(temp_reg, Address(temp_reg, 0));
+ AddImmediate(temp_reg, class_offset);
+ }
+ const uword state_offset = ClassHeapStats::state_offset();
+ const Address& state_address = Address(temp_reg, state_offset);
+ lw(temp_reg, state_address);
+ andi(CMPRES1, temp_reg, Immediate(ClassHeapStats::TraceAllocationMask()));
+ bne(CMPRES1, ZR, trace);
+}
+
+
void Assembler::TryAllocate(const Class& cls,
Label* failure,
Register instance_reg,
@@ -897,6 +924,10 @@ void Assembler::TryAllocate(const Class& cls,
ASSERT(!in_delay_slot_);
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(), temp_reg, failure);
const intptr_t instance_size = cls.instance_size();
Heap* heap = Isolate::Current()->heap();
Heap::Space space = heap->SpaceForAllocation(cls.id());
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698