| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 static intptr_t allocated_size_since_gc_old_space_offset() { | 90 static intptr_t allocated_size_since_gc_old_space_offset() { |
| 91 return OFFSET_OF(ClassHeapStats, recent) + | 91 return OFFSET_OF(ClassHeapStats, recent) + |
| 92 OFFSET_OF(AllocStats<intptr_t>, old_size); | 92 OFFSET_OF(AllocStats<intptr_t>, old_size); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void Initialize(); | 95 void Initialize(); |
| 96 void ResetAtNewGC(); | 96 void ResetAtNewGC(); |
| 97 void ResetAtOldGC(); | 97 void ResetAtOldGC(); |
| 98 void ResetAccumulator(); | 98 void ResetAccumulator(); |
| 99 void UpdateSize(intptr_t instance_size); | 99 void UpdateSize(intptr_t instance_size); |
| 100 void PrintTOJSONArray(const Class& cls, JSONArray* array); | 100 void PrintToJSONObject(const Class& cls, JSONObject* obj) const; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 | 103 |
| 104 class ClassTable { | 104 class ClassTable { |
| 105 public: | 105 public: |
| 106 ClassTable(); | 106 ClassTable(); |
| 107 ~ClassTable(); | 107 ~ClassTable(); |
| 108 | 108 |
| 109 RawClass* At(intptr_t index) const { | 109 RawClass* At(intptr_t index) const { |
| 110 ASSERT(IsValidIndex(index)); | 110 ASSERT(IsValidIndex(index)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Used by the generated code. | 150 // Used by the generated code. |
| 151 uword PredefinedClassHeapStatsTableAddress() { | 151 uword PredefinedClassHeapStatsTableAddress() { |
| 152 return reinterpret_cast<uword>(predefined_class_heap_stats_table_); | 152 return reinterpret_cast<uword>(predefined_class_heap_stats_table_); |
| 153 } | 153 } |
| 154 | 154 |
| 155 // Used by generated code. | 155 // Used by generated code. |
| 156 uword ClassStatsTableAddress() { | 156 uword ClassStatsTableAddress() { |
| 157 return reinterpret_cast<uword>(&class_heap_stats_table_); | 157 return reinterpret_cast<uword>(&class_heap_stats_table_); |
| 158 } | 158 } |
| 159 | 159 |
| 160 ClassHeapStats* StatsWithUpdatedSize(intptr_t cid); |
| 160 | 161 |
| 161 void AllocationProfilePrintJSON(JSONStream* stream); | 162 void AllocationProfilePrintJSON(JSONStream* stream); |
| 162 void ResetAllocationAccumulators(); | 163 void ResetAllocationAccumulators(); |
| 163 | 164 |
| 164 private: | 165 private: |
| 165 friend class MarkingVisitor; | 166 friend class MarkingVisitor; |
| 166 friend class ScavengerVisitor; | 167 friend class ScavengerVisitor; |
| 167 friend class ClassHeapStatsTestHelper; | 168 friend class ClassHeapStatsTestHelper; |
| 168 static const int initial_capacity_ = 512; | 169 static const int initial_capacity_ = 512; |
| 169 static const int capacity_increment_ = 256; | 170 static const int capacity_increment_ = 256; |
| 170 | 171 |
| 171 static bool ShouldUpdateSizeForClassId(intptr_t cid); | 172 static bool ShouldUpdateSizeForClassId(intptr_t cid); |
| 172 | 173 |
| 173 intptr_t top_; | 174 intptr_t top_; |
| 174 intptr_t capacity_; | 175 intptr_t capacity_; |
| 175 | 176 |
| 176 RawClass** table_; | 177 RawClass** table_; |
| 177 ClassHeapStats* class_heap_stats_table_; | 178 ClassHeapStats* class_heap_stats_table_; |
| 178 | 179 |
| 179 ClassHeapStats* predefined_class_heap_stats_table_; | 180 ClassHeapStats* predefined_class_heap_stats_table_; |
| 180 | 181 |
| 181 ClassHeapStats* StatsAt(intptr_t cid); | 182 // May not have updated size for variable size classes. |
| 183 ClassHeapStats* PreliminaryStatsAt(intptr_t cid); |
| 182 void UpdateLiveOld(intptr_t cid, intptr_t size); | 184 void UpdateLiveOld(intptr_t cid, intptr_t size); |
| 183 void UpdateLiveNew(intptr_t cid, intptr_t size); | 185 void UpdateLiveNew(intptr_t cid, intptr_t size); |
| 184 | 186 |
| 185 DISALLOW_COPY_AND_ASSIGN(ClassTable); | 187 DISALLOW_COPY_AND_ASSIGN(ClassTable); |
| 186 }; | 188 }; |
| 187 | 189 |
| 188 } // namespace dart | 190 } // namespace dart |
| 189 | 191 |
| 190 #endif // VM_CLASS_TABLE_H_ | 192 #endif // VM_CLASS_TABLE_H_ |
| OLD | NEW |