Index: runtime/vm/assembler_arm.cc |
diff --git a/runtime/vm/assembler_arm.cc b/runtime/vm/assembler_arm.cc |
index 663baafbc531288b9612b0a80bf0912e21c5d411..a641c82effd2a3daaff2178f7dc671743ec3061f 100644 |
--- a/runtime/vm/assembler_arm.cc |
+++ b/runtime/vm/assembler_arm.cc |
@@ -2641,9 +2641,96 @@ void Assembler::LeaveStubFrame() { |
} |
+void Assembler::BumpAllocationCount(Heap::Space space, |
Ivan Posva
2013/12/12 13:53:24
UpdateAllocationCount or UpdateAllocationStats.
Cutch
2013/12/13 01:31:09
Done.
|
+ intptr_t cid, |
+ Register temp_reg) { |
+ ASSERT(temp_reg != kNoRegister); |
+ ASSERT(temp_reg != TMP); |
+ ASSERT(cid > 0); |
+ Isolate* isolate = Isolate::Current(); |
+ ClassTable* class_table = isolate->class_table(); |
+ if (cid < kNumPredefinedCids) { |
+ const uword class_heap_stats_table_address = |
+ class_table->PredefinedClassHeapStatsTableAddress(); |
+ const uword class_offset = cid * sizeof(ClassHeapStats); // NOLINT |
+ const uword count_field_offset = space == Heap::kNew ? |
srdjan
2013/12/12 15:52:32
I find it more readable to put parentheses around
Cutch
2013/12/13 01:31:09
Done in all 16 places.
|
+ ClassHeapStats::new_count_since_gc_new_space_offset() : |
+ ClassHeapStats::new_count_since_gc_old_space_offset(); |
+ const Address& count_address = Address(temp_reg, count_field_offset); |
Ivan Posva
2013/12/12 13:53:24
Please move the Address calculation after the Load
Cutch
2013/12/13 01:31:09
Done.
|
+ LoadImmediate(temp_reg, class_heap_stats_table_address + class_offset); |
+ ldr(TMP, count_address); |
+ AddImmediate(TMP, 1); |
+ str(TMP, count_address); |
+ } else { |
+ ASSERT(temp_reg != kNoRegister); |
+ const uword class_offset = cid * sizeof(ClassHeapStats); // NOLINT |
+ const uword count_field_offset = space == Heap::kNew ? |
+ ClassHeapStats::new_count_since_gc_new_space_offset() : |
+ ClassHeapStats::new_count_since_gc_old_space_offset(); |
+ LoadImmediate(temp_reg, class_table->ClassStatsTableAddress()); |
+ ldr(temp_reg, Address(temp_reg, 0)); |
+ AddImmediate(temp_reg, class_offset); |
+ ldr(TMP, Address(temp_reg, count_field_offset)); |
+ AddImmediate(TMP, 1); |
+ str(TMP, Address(temp_reg, count_field_offset)); |
+ } |
+} |
+ |
+ |
+void Assembler::BumpAllocationCount(Heap::Space space, |
+ intptr_t cid, |
+ Register size_reg, |
+ Register temp_reg) { |
+ ASSERT(temp_reg != kNoRegister); |
+ ASSERT(temp_reg != TMP); |
+ ASSERT(cid > 0); |
+ Isolate* isolate = Isolate::Current(); |
+ ClassTable* class_table = isolate->class_table(); |
+ if (cid < kNumPredefinedCids) { |
+ const uword class_heap_stats_table_address = |
+ class_table->PredefinedClassHeapStatsTableAddress(); |
+ const uword class_offset = cid * sizeof(ClassHeapStats); // NOLINT |
+ const uword count_field_offset = space == Heap::kNew ? |
+ ClassHeapStats::new_count_since_gc_new_space_offset() : |
+ ClassHeapStats::new_count_since_gc_old_space_offset(); |
+ const uword size_field_offset = space == Heap::kNew ? |
+ ClassHeapStats::new_size_since_gc_new_space_offset() : |
+ ClassHeapStats::new_size_since_gc_old_space_offset(); |
+ const Address& count_address = Address(temp_reg, count_field_offset); |
+ const Address& size_address = Address(temp_reg, size_field_offset); |
+ LoadImmediate(temp_reg, class_heap_stats_table_address + class_offset); |
Ivan Posva
2013/12/12 13:53:24
ditto
Cutch
2013/12/13 01:31:09
Done.
|
+ ldr(TMP, count_address); |
+ AddImmediate(TMP, 1); |
+ str(TMP, count_address); |
+ ldr(TMP, size_address); |
+ add(TMP, TMP, ShifterOperand(size_reg)); |
+ str(TMP, size_address); |
+ } else { |
+ ASSERT(temp_reg != kNoRegister); |
+ const uword class_offset = cid * sizeof(ClassHeapStats); // NOLINT |
+ const uword count_field_offset = space == Heap::kNew ? |
+ ClassHeapStats::new_count_since_gc_new_space_offset() : |
+ ClassHeapStats::new_count_since_gc_old_space_offset(); |
+ const uword size_field_offset = space == Heap::kNew ? |
+ ClassHeapStats::new_size_since_gc_new_space_offset() : |
+ ClassHeapStats::new_size_since_gc_old_space_offset(); |
+ LoadImmediate(temp_reg, class_table->ClassStatsTableAddress()); |
+ ldr(temp_reg, Address(temp_reg, 0)); |
+ AddImmediate(temp_reg, class_offset); |
+ ldr(TMP, Address(temp_reg, count_field_offset)); |
+ AddImmediate(TMP, 1); |
+ str(TMP, Address(temp_reg, count_field_offset)); |
+ ldr(TMP, Address(temp_reg, size_field_offset)); |
+ add(TMP, TMP, ShifterOperand(size_reg)); |
+ str(TMP, Address(temp_reg, size_field_offset)); |
+ } |
+} |
+ |
+ |
void Assembler::TryAllocate(const Class& cls, |
Label* failure, |
- Register instance_reg) { |
+ Register instance_reg, |
+ Register temp_reg) { |
ASSERT(failure != NULL); |
if (FLAG_inline_alloc) { |
Heap* heap = Isolate::Current()->heap(); |
@@ -2666,6 +2753,7 @@ void Assembler::TryAllocate(const Class& cls, |
ASSERT(instance_size >= kHeapObjectTag); |
AddImmediate(instance_reg, -instance_size + kHeapObjectTag); |
+ BumpAllocationCount(Heap::kNew, cls.id(), temp_reg); |
uword tags = 0; |
tags = RawObject::SizeTag::update(instance_size, tags); |