Chromium Code Reviews| Index: runtime/vm/assembler_ia32.cc |
| diff --git a/runtime/vm/assembler_ia32.cc b/runtime/vm/assembler_ia32.cc |
| index 8f6164fcfef9614c1d1274517dbbf0993e02246e..71337266955d9c97c02a1b4ceb1bbe71fd3895dd 100644 |
| --- a/runtime/vm/assembler_ia32.cc |
| +++ b/runtime/vm/assembler_ia32.cc |
| @@ -8,6 +8,7 @@ |
| #include "vm/assembler.h" |
| #include "vm/code_generator.h" |
| #include "vm/heap.h" |
| +#include "vm/heap_class_stats.h" |
| #include "vm/memory_region.h" |
| #include "vm/runtime_entry.h" |
| #include "vm/stack_frame.h" |
| @@ -2263,6 +2264,23 @@ void Assembler::Bind(Label* label) { |
| } |
| +// Updates the allocation count for cid. |
| +void Assembler::BumpAllocationCount(intptr_t cid, |
| + Register temp_reg) { |
| + ASSERT(temp_reg != kNoRegister); |
| + HeapClassStatistics* heap_class_stats = |
| + Isolate::Current()->heap_class_stats(); |
| + // temp_reg gets address of class table pointer. |
| + movl(temp_reg, Address::Absolute(heap_class_stats->ClassStatsTableAddress())); |
| + // Offset into class table. |
| + const intptr_t offset = cid * sizeof(HeapClassData); // NOLINT |
| + // temp_reg points at HeapClassData for cid + offset to allocation count. |
| + leal(temp_reg, Address(temp_reg, offset)); |
| + // Increment allocation count. |
| + addl(Address(temp_reg, HeapClassData::allocated_since_gc_offset()), |
| + Immediate(1)); |
| +} |
| + |
| void Assembler::TryAllocate(const Class& cls, |
| Label* failure, |
| bool near_jump, |
| @@ -2279,6 +2297,9 @@ void Assembler::TryAllocate(const Class& cls, |
| // Successfully allocated the object, now update top to point to |
| // next object start and store the class in the class field of object. |
| movl(Address::Absolute(heap->TopAddress()), instance_reg); |
| + pushl(instance_reg); |
|
Florian Schneider
2013/10/31 09:56:01
I suspect that this will make bump allocation a _l
Cutch
2013/10/31 11:20:02
I will run some tests tomorrow against patch set 2
|
| + BumpAllocationCount(cls.id(), instance_reg); |
| + popl(instance_reg); |
| ASSERT(instance_size >= kHeapObjectTag); |
| subl(instance_reg, Immediate(instance_size - kHeapObjectTag)); |
| uword tags = 0; |