| 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/bitfield.h" | 9 #include "vm/bitfield.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 void AddNew(T size) { | 36 void AddNew(T size) { |
| 37 new_count++; | 37 new_count++; |
| 38 new_size += size; | 38 new_size += size; |
| 39 } | 39 } |
| 40 | 40 |
| 41 void ResetOld() { | 41 void ResetOld() { |
| 42 old_count = 0; | 42 old_count = 0; |
| 43 old_size = 0; | 43 old_size = 0; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void AddOld(T size) { | 46 void AddOld(T size, T count = 1) { |
| 47 old_count++; | 47 old_count += count; |
| 48 old_size += size; | 48 old_size += size; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void Reset() { | 51 void Reset() { |
| 52 new_count = 0; | 52 new_count = 0; |
| 53 new_size = 0; | 53 new_size = 0; |
| 54 old_count = 0; | 54 old_count = 0; |
| 55 old_size = 0; | 55 old_size = 0; |
| 56 } | 56 } |
| 57 | 57 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 void AllocationProfilePrintJSON(JSONStream* stream); | 215 void AllocationProfilePrintJSON(JSONStream* stream); |
| 216 void ResetAllocationAccumulators(); | 216 void ResetAllocationAccumulators(); |
| 217 | 217 |
| 218 // Deallocates table copies. Do not call during concurrent access to table. | 218 // Deallocates table copies. Do not call during concurrent access to table. |
| 219 void FreeOldTables(); | 219 void FreeOldTables(); |
| 220 | 220 |
| 221 void SetTraceAllocationFor(intptr_t cid, bool trace); | 221 void SetTraceAllocationFor(intptr_t cid, bool trace); |
| 222 bool TraceAllocationFor(intptr_t cid); | 222 bool TraceAllocationFor(intptr_t cid); |
| 223 | 223 |
| 224 private: | 224 private: |
| 225 friend class MarkingVisitor; | 225 friend class GCMarker; |
| 226 friend class ScavengerVisitor; | 226 friend class ScavengerVisitor; |
| 227 friend class ClassHeapStatsTestHelper; | 227 friend class ClassHeapStatsTestHelper; |
| 228 static const int initial_capacity_ = 512; | 228 static const int initial_capacity_ = 512; |
| 229 static const int capacity_increment_ = 256; | 229 static const int capacity_increment_ = 256; |
| 230 | 230 |
| 231 static bool ShouldUpdateSizeForClassId(intptr_t cid); | 231 static bool ShouldUpdateSizeForClassId(intptr_t cid); |
| 232 | 232 |
| 233 intptr_t top_; | 233 intptr_t top_; |
| 234 intptr_t capacity_; | 234 intptr_t capacity_; |
| 235 | 235 |
| 236 // Copy-on-write is used for table_, with old copies stored in old_tables_. | 236 // Copy-on-write is used for table_, with old copies stored in old_tables_. |
| 237 RawClass** table_; | 237 RawClass** table_; |
| 238 MallocGrowableArray<RawClass**>* old_tables_; | 238 MallocGrowableArray<RawClass**>* old_tables_; |
| 239 | 239 |
| 240 ClassHeapStats* class_heap_stats_table_; | 240 ClassHeapStats* class_heap_stats_table_; |
| 241 | 241 |
| 242 ClassHeapStats* predefined_class_heap_stats_table_; | 242 ClassHeapStats* predefined_class_heap_stats_table_; |
| 243 | 243 |
| 244 // May not have updated size for variable size classes. | 244 // May not have updated size for variable size classes. |
| 245 ClassHeapStats* PreliminaryStatsAt(intptr_t cid); | 245 ClassHeapStats* PreliminaryStatsAt(intptr_t cid); |
| 246 void UpdateLiveOld(intptr_t cid, intptr_t size); | 246 void UpdateLiveOld(intptr_t cid, intptr_t size, intptr_t count = 1); |
| 247 void UpdateLiveNew(intptr_t cid, intptr_t size); | 247 void UpdateLiveNew(intptr_t cid, intptr_t size); |
| 248 | 248 |
| 249 DISALLOW_COPY_AND_ASSIGN(ClassTable); | 249 DISALLOW_COPY_AND_ASSIGN(ClassTable); |
| 250 }; | 250 }; |
| 251 | 251 |
| 252 } // namespace dart | 252 } // namespace dart |
| 253 | 253 |
| 254 #endif // VM_CLASS_TABLE_H_ | 254 #endif // VM_CLASS_TABLE_H_ |
| OLD | NEW |