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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 old_size = 0; | 53 old_size = 0; |
54 } | 54 } |
55 | 55 |
56 // For classes with fixed instance size we do not emit code to update | 56 // For classes with fixed instance size we do not emit code to update |
57 // the size statistics. Update them by calling this method. | 57 // the size statistics. Update them by calling this method. |
58 void UpdateSize(intptr_t instance_size) { | 58 void UpdateSize(intptr_t instance_size) { |
59 ASSERT(instance_size > 0); | 59 ASSERT(instance_size > 0); |
60 old_size = old_count * instance_size; | 60 old_size = old_count * instance_size; |
61 new_size = new_count * instance_size; | 61 new_size = new_count * instance_size; |
62 } | 62 } |
| 63 |
| 64 void Verify() { |
| 65 ASSERT(new_count >= 0); |
| 66 ASSERT(new_size >= 0); |
| 67 ASSERT(old_count >= 0); |
| 68 ASSERT(old_size >= 0); |
| 69 } |
63 }; | 70 }; |
64 | 71 |
65 class ClassHeapStats { | 72 class ClassHeapStats { |
66 public: | 73 public: |
67 // Snapshot before GC. | 74 // Snapshot before GC. |
68 AllocStats<intptr_t> pre_gc; | 75 AllocStats<intptr_t> pre_gc; |
69 // Live after GC. | 76 // Live after GC. |
70 AllocStats<intptr_t> post_gc; | 77 AllocStats<intptr_t> post_gc; |
71 // Allocations since the last GC. | 78 // Allocations since the last GC. |
72 AllocStats<intptr_t> recent; | 79 AllocStats<intptr_t> recent; |
(...skipping 27 matching lines...) Expand all Loading... |
100 void ResetAtOldGC(); | 107 void ResetAtOldGC(); |
101 void ResetAccumulator(); | 108 void ResetAccumulator(); |
102 void UpdatePromotedAfterNewGC(); | 109 void UpdatePromotedAfterNewGC(); |
103 void UpdateSize(intptr_t instance_size); | 110 void UpdateSize(intptr_t instance_size); |
104 void PrintToJSONObject(const Class& cls, JSONObject* obj) const; | 111 void PrintToJSONObject(const Class& cls, JSONObject* obj) const; |
105 | 112 |
106 private: | 113 private: |
107 // Recent old at start of last new GC (used to compute promoted_*). | 114 // Recent old at start of last new GC (used to compute promoted_*). |
108 intptr_t old_pre_new_gc_count_; | 115 intptr_t old_pre_new_gc_count_; |
109 intptr_t old_pre_new_gc_size_; | 116 intptr_t old_pre_new_gc_size_; |
| 117 |
| 118 void Verify(); |
110 }; | 119 }; |
111 | 120 |
112 | 121 |
113 class ClassTable { | 122 class ClassTable { |
114 public: | 123 public: |
115 ClassTable(); | 124 ClassTable(); |
116 // Create a copy of the original class table only, without copying any of the | 125 // Create a copy of the original class table only, without copying any of the |
117 // stats data. | 126 // stats data. |
118 explicit ClassTable(ClassTable* original); | 127 explicit ClassTable(ClassTable* original); |
119 ~ClassTable(); | 128 ~ClassTable(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ClassHeapStats* PreliminaryStatsAt(intptr_t cid); | 211 ClassHeapStats* PreliminaryStatsAt(intptr_t cid); |
203 void UpdateLiveOld(intptr_t cid, intptr_t size); | 212 void UpdateLiveOld(intptr_t cid, intptr_t size); |
204 void UpdateLiveNew(intptr_t cid, intptr_t size); | 213 void UpdateLiveNew(intptr_t cid, intptr_t size); |
205 | 214 |
206 DISALLOW_COPY_AND_ASSIGN(ClassTable); | 215 DISALLOW_COPY_AND_ASSIGN(ClassTable); |
207 }; | 216 }; |
208 | 217 |
209 } // namespace dart | 218 } // namespace dart |
210 | 219 |
211 #endif // VM_CLASS_TABLE_H_ | 220 #endif // VM_CLASS_TABLE_H_ |
OLD | NEW |