Chromium Code Reviews| Index: runtime/vm/class_table.h |
| diff --git a/runtime/vm/class_table.h b/runtime/vm/class_table.h |
| index 6ea4dfa7034b94199d53dd94381ad803e3af19c8..261f920be3e1a471200e69a16a40bd594080ddd4 100644 |
| --- a/runtime/vm/class_table.h |
| +++ b/runtime/vm/class_table.h |
| @@ -11,10 +11,42 @@ |
| namespace dart { |
| class Class; |
| +class ClassStats; |
| class ObjectPointerVisitor; |
| class RawClass; |
| class JSONStream; |
| +class ClassHeapStats { |
| + public: |
| + intptr_t live_count_old_space; |
| + intptr_t live_count_new_space; |
| + intptr_t live_size_old_space; |
| + intptr_t live_size_new_space; |
| + |
| + // These fields are updated by generated code: |
| + intptr_t new_count_since_gc_new_space; |
| + intptr_t new_count_since_gc_old_space; |
| + intptr_t new_size_since_gc_new_space; |
| + intptr_t new_size_since_gc_old_space; |
| + |
| + static intptr_t new_count_since_gc_new_space_offset() { |
| + return OFFSET_OF(ClassHeapStats, new_count_since_gc_new_space); |
| + } |
| + static intptr_t new_count_since_gc_old_space_offset() { |
| + return OFFSET_OF(ClassHeapStats, new_count_since_gc_old_space); |
| + } |
| + static intptr_t new_size_since_gc_new_space_offset() { |
| + return OFFSET_OF(ClassHeapStats, new_size_since_gc_new_space); |
| + } |
| + static intptr_t new_size_since_gc_old_space_offset() { |
| + return OFFSET_OF(ClassHeapStats, new_size_since_gc_old_space); |
| + } |
| + |
| + void Initialize(); |
| + void ResetAtGC(); |
| +}; |
| + |
| + |
| class ClassTable { |
| public: |
| ClassTable(); |
| @@ -48,7 +80,25 @@ class ClassTable { |
| return OFFSET_OF(ClassTable, table_); |
| } |
| + // Called whenever a class is allocated in the runtime. |
| + void AllocateClassNewSpace(intptr_t cid, intptr_t size); |
|
Florian Schneider
2013/11/13 18:06:53
Maybe ReportAllocation would be a better name?
Yo
Cutch
2013/11/13 19:09:34
Done.
|
| + void AllocateClassOldSpace(intptr_t cid, intptr_t size); |
| + |
| + // Called whenever a major GC occurs. |
| + void Collect(); |
| + |
| + // Used by the generated code. |
| + uword PredefinedClassHeapStatsTableAddress() { |
| + return reinterpret_cast<uword>(predefined_class_heap_stats_table_); |
| + } |
| + |
| + // Used by generated code. |
| + uword ClassStatsTableAddress() { |
| + return reinterpret_cast<uword>(&class_heap_stats_table_); |
| + } |
| + |
| private: |
| + friend class MarkingVisitor; |
| static const int initial_capacity_ = 512; |
| static const int capacity_increment_ = 256; |
| @@ -56,6 +106,14 @@ class ClassTable { |
| intptr_t capacity_; |
| RawClass** table_; |
| + ClassHeapStats* class_heap_stats_table_; |
| + |
| + ClassHeapStats* predefined_class_heap_stats_table_; |
| + |
| + ClassHeapStats* FindClassHeapStats(intptr_t cid); |
| + void ResetCounters(); |
| + void ReportLiveOldSpace(intptr_t cid, intptr_t size); |
| + void ReportLiveNewSpace(intptr_t cid, intptr_t size); |
| DISALLOW_COPY_AND_ASSIGN(ClassTable); |
| }; |