Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_CLASS_TABLE_H_ | 5 #ifndef VM_CLASS_TABLE_H_ |
| 6 #define VM_CLASS_TABLE_H_ | 6 #define VM_CLASS_TABLE_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 intptr_t live_after_gc_new_space; | 31 intptr_t live_after_gc_new_space; |
| 32 intptr_t live_size_after_gc_old_space; | 32 intptr_t live_size_after_gc_old_space; |
| 33 intptr_t live_size_after_gc_new_space; | 33 intptr_t live_size_after_gc_new_space; |
| 34 | 34 |
| 35 // Allocated since GC. | 35 // Allocated since GC. |
| 36 intptr_t allocated_since_gc_new_space; | 36 intptr_t allocated_since_gc_new_space; |
| 37 intptr_t allocated_since_gc_old_space; | 37 intptr_t allocated_since_gc_old_space; |
| 38 intptr_t allocated_size_since_gc_new_space; | 38 intptr_t allocated_size_since_gc_new_space; |
| 39 intptr_t allocated_size_since_gc_old_space; | 39 intptr_t allocated_size_since_gc_old_space; |
| 40 | 40 |
| 41 // Accumulator. | |
| 42 int64_t accumulated_post_gc_new_space; | |
| 43 int64_t accumulated_post_gc_old_space; | |
| 44 int64_t accumulated_post_gc_size_new_space; | |
| 45 int64_t accumulated_post_gc_size_old_space; | |
| 46 | |
| 47 // Offset used when zeroing accumulators. | |
| 48 intptr_t accumulator_new_space_offset; | |
| 49 intptr_t accumulator_old_space_offset; | |
| 50 intptr_t accumulator_size_new_space_offset; | |
| 51 intptr_t accumulator_size_old_space_offset; | |
|
turnidge
2014/02/27 18:29:13
Notes from our offline discussion:
struct AllocSt
Cutch
2014/02/27 21:50:33
Done.
| |
| 52 | |
| 41 static intptr_t allocated_since_gc_new_space_offset() { | 53 static intptr_t allocated_since_gc_new_space_offset() { |
| 42 return OFFSET_OF(ClassHeapStats, allocated_since_gc_new_space); | 54 return OFFSET_OF(ClassHeapStats, allocated_since_gc_new_space); |
| 43 } | 55 } |
| 44 static intptr_t allocated_since_gc_old_space_offset() { | 56 static intptr_t allocated_since_gc_old_space_offset() { |
| 45 return OFFSET_OF(ClassHeapStats, allocated_since_gc_old_space); | 57 return OFFSET_OF(ClassHeapStats, allocated_since_gc_old_space); |
| 46 } | 58 } |
| 47 static intptr_t allocated_size_since_gc_new_space_offset() { | 59 static intptr_t allocated_size_since_gc_new_space_offset() { |
| 48 return OFFSET_OF(ClassHeapStats, allocated_size_since_gc_new_space); | 60 return OFFSET_OF(ClassHeapStats, allocated_size_since_gc_new_space); |
| 49 } | 61 } |
| 50 static intptr_t allocated_size_since_gc_old_space_offset() { | 62 static intptr_t allocated_size_since_gc_old_space_offset() { |
| 51 return OFFSET_OF(ClassHeapStats, allocated_size_since_gc_old_space); | 63 return OFFSET_OF(ClassHeapStats, allocated_size_since_gc_old_space); |
| 52 } | 64 } |
| 53 | 65 |
| 54 void Initialize(); | 66 void Initialize(); |
| 55 void ResetAtNewGC(); | 67 void ResetAtNewGC(); |
| 56 void ResetAtOldGC(); | 68 void ResetAtOldGC(); |
| 69 void ResetAccumulator(); | |
| 57 void UpdateSize(intptr_t instance_size); | 70 void UpdateSize(intptr_t instance_size); |
| 58 void PrintTOJSONArray(const Class& cls, JSONArray* array); | 71 void PrintTOJSONArray(const Class& cls, JSONArray* array); |
| 59 }; | 72 }; |
| 60 | 73 |
| 61 | 74 |
| 62 class ClassTable { | 75 class ClassTable { |
| 63 public: | 76 public: |
| 64 ClassTable(); | 77 ClassTable(); |
| 65 ~ClassTable(); | 78 ~ClassTable(); |
| 66 | 79 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 return reinterpret_cast<uword>(predefined_class_heap_stats_table_); | 119 return reinterpret_cast<uword>(predefined_class_heap_stats_table_); |
| 107 } | 120 } |
| 108 | 121 |
| 109 // Used by generated code. | 122 // Used by generated code. |
| 110 uword ClassStatsTableAddress() { | 123 uword ClassStatsTableAddress() { |
| 111 return reinterpret_cast<uword>(&class_heap_stats_table_); | 124 return reinterpret_cast<uword>(&class_heap_stats_table_); |
| 112 } | 125 } |
| 113 | 126 |
| 114 | 127 |
| 115 void AllocationProfilePrintToJSONStream(JSONStream* stream); | 128 void AllocationProfilePrintToJSONStream(JSONStream* stream); |
| 129 void ResetAllocationAccumulators(); | |
| 116 | 130 |
| 117 private: | 131 private: |
| 118 friend class MarkingVisitor; | 132 friend class MarkingVisitor; |
| 119 friend class ScavengerVisitor; | 133 friend class ScavengerVisitor; |
| 120 friend class ClassHeapStatsTestHelper; | 134 friend class ClassHeapStatsTestHelper; |
| 121 static const int initial_capacity_ = 512; | 135 static const int initial_capacity_ = 512; |
| 122 static const int capacity_increment_ = 256; | 136 static const int capacity_increment_ = 256; |
| 123 | 137 |
| 124 static bool ShouldUpdateSizeForClassId(intptr_t cid); | 138 static bool ShouldUpdateSizeForClassId(intptr_t cid); |
| 125 | 139 |
| 126 intptr_t top_; | 140 intptr_t top_; |
| 127 intptr_t capacity_; | 141 intptr_t capacity_; |
| 128 | 142 |
| 129 RawClass** table_; | 143 RawClass** table_; |
| 130 ClassHeapStats* class_heap_stats_table_; | 144 ClassHeapStats* class_heap_stats_table_; |
| 131 | 145 |
| 132 ClassHeapStats* predefined_class_heap_stats_table_; | 146 ClassHeapStats* predefined_class_heap_stats_table_; |
| 133 | 147 |
| 134 ClassHeapStats* StatsAt(intptr_t cid); | 148 ClassHeapStats* StatsAt(intptr_t cid); |
| 135 void UpdateLiveOld(intptr_t cid, intptr_t size); | 149 void UpdateLiveOld(intptr_t cid, intptr_t size); |
| 136 void UpdateLiveNew(intptr_t cid, intptr_t size); | 150 void UpdateLiveNew(intptr_t cid, intptr_t size); |
| 137 | 151 |
| 138 DISALLOW_COPY_AND_ASSIGN(ClassTable); | 152 DISALLOW_COPY_AND_ASSIGN(ClassTable); |
| 139 }; | 153 }; |
| 140 | 154 |
| 141 } // namespace dart | 155 } // namespace dart |
| 142 | 156 |
| 143 #endif // VM_CLASS_TABLE_H_ | 157 #endif // VM_CLASS_TABLE_H_ |
| OLD | NEW |