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_SCAVENGER_H_ | 5 #ifndef VM_SCAVENGER_H_ |
6 #define VM_SCAVENGER_H_ | 6 #define VM_SCAVENGER_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/utils.h" | 9 #include "platform/utils.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 *end = to_->end(); | 82 *end = to_->end(); |
83 } | 83 } |
84 | 84 |
85 // Returns true if the last scavenge had a promotion failure. | 85 // Returns true if the last scavenge had a promotion failure. |
86 bool HadPromotionFailure() { | 86 bool HadPromotionFailure() { |
87 return had_promotion_failure_; | 87 return had_promotion_failure_; |
88 } | 88 } |
89 | 89 |
90 void WriteProtect(bool read_only); | 90 void WriteProtect(bool read_only); |
91 | 91 |
| 92 void AddGCTime(int64_t micros) { |
| 93 gc_time_micros_ += micros; |
| 94 } |
| 95 |
| 96 int64_t gc_time_micros() const { |
| 97 return gc_time_micros_; |
| 98 } |
| 99 |
| 100 void IncrementCollections() { |
| 101 collections_++; |
| 102 } |
| 103 |
| 104 intptr_t collections() const { |
| 105 return collections_; |
| 106 } |
| 107 |
92 private: | 108 private: |
93 // Ids for time and data records in Heap::GCStats. | 109 // Ids for time and data records in Heap::GCStats. |
94 enum { | 110 enum { |
95 // Time | 111 // Time |
96 kVisitIsolateRoots = 0, | 112 kVisitIsolateRoots = 0, |
97 kIterateStoreBuffers = 1, | 113 kIterateStoreBuffers = 1, |
98 kProcessToSpace = 2, | 114 kProcessToSpace = 2, |
99 kIterateWeaks = 3, | 115 kIterateWeaks = 3, |
100 // Data | 116 // Data |
101 kStoreBufferEntries = 0, | 117 kStoreBufferEntries = 0, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 uword survivor_end_; | 181 uword survivor_end_; |
166 | 182 |
167 // All object are aligned to this value. | 183 // All object are aligned to this value. |
168 uword object_alignment_; | 184 uword object_alignment_; |
169 | 185 |
170 // Keep track whether a scavenge is currently running. | 186 // Keep track whether a scavenge is currently running. |
171 bool scavenging_; | 187 bool scavenging_; |
172 // Keep track whether the scavenge had a promotion failure. | 188 // Keep track whether the scavenge had a promotion failure. |
173 bool had_promotion_failure_; | 189 bool had_promotion_failure_; |
174 | 190 |
| 191 int64_t gc_time_micros_; |
| 192 intptr_t collections_; |
| 193 |
175 friend class ScavengerVisitor; | 194 friend class ScavengerVisitor; |
176 friend class ScavengerWeakVisitor; | 195 friend class ScavengerWeakVisitor; |
177 | 196 |
178 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 197 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
179 }; | 198 }; |
180 | 199 |
181 } // namespace dart | 200 } // namespace dart |
182 | 201 |
183 #endif // VM_SCAVENGER_H_ | 202 #endif // VM_SCAVENGER_H_ |
OLD | NEW |