| 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/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 uword FirstObjectStart() const { return to_->start() | object_alignment_; } | 227 uword FirstObjectStart() const { return to_->start() | object_alignment_; } |
| 228 SemiSpace* Prologue(Isolate* isolate, bool invoke_api_callbacks); | 228 SemiSpace* Prologue(Isolate* isolate, bool invoke_api_callbacks); |
| 229 void IterateStoreBuffers(Isolate* isolate, ScavengerVisitor* visitor); | 229 void IterateStoreBuffers(Isolate* isolate, ScavengerVisitor* visitor); |
| 230 void IterateObjectIdTable(Isolate* isolate, ScavengerVisitor* visitor); | 230 void IterateObjectIdTable(Isolate* isolate, ScavengerVisitor* visitor); |
| 231 void IterateRoots(Isolate* isolate, ScavengerVisitor* visitor); | 231 void IterateRoots(Isolate* isolate, ScavengerVisitor* visitor); |
| 232 void IterateWeakProperties(Isolate* isolate, ScavengerVisitor* visitor); | 232 void IterateWeakProperties(Isolate* isolate, ScavengerVisitor* visitor); |
| 233 void IterateWeakReferences(Isolate* isolate, ScavengerVisitor* visitor); | 233 void IterateWeakReferences(Isolate* isolate, ScavengerVisitor* visitor); |
| 234 void IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor); | 234 void IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor); |
| 235 void ProcessToSpace(ScavengerVisitor* visitor); | 235 void ProcessToSpace(ScavengerVisitor* visitor); |
| 236 void EnqueueWeakProperty(RawWeakProperty* raw_weak); |
| 236 uword ProcessWeakProperty(RawWeakProperty* raw_weak, | 237 uword ProcessWeakProperty(RawWeakProperty* raw_weak, |
| 237 ScavengerVisitor* visitor); | 238 ScavengerVisitor* visitor); |
| 238 void Epilogue(Isolate* isolate, SemiSpace* from, bool invoke_api_callbacks); | 239 void Epilogue(Isolate* isolate, SemiSpace* from, bool invoke_api_callbacks); |
| 239 | 240 |
| 240 bool IsUnreachable(RawObject** p); | 241 bool IsUnreachable(RawObject** p); |
| 241 | 242 |
| 242 // During a scavenge we need to remember the promoted objects. | 243 // During a scavenge we need to remember the promoted objects. |
| 243 // This is implemented as a stack of objects at the end of the to space. As | 244 // This is implemented as a stack of objects at the end of the to space. As |
| 244 // object sizes are always greater than sizeof(uword) and promoted objects do | 245 // object sizes are always greater than sizeof(uword) and promoted objects do |
| 245 // not consume space in the to space they leave enough room for this stack. | 246 // not consume space in the to space they leave enough room for this stack. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 257 return result; | 258 return result; |
| 258 } | 259 } |
| 259 bool PromotedStackHasMore() const { | 260 bool PromotedStackHasMore() const { |
| 260 ASSERT(scavenging_); | 261 ASSERT(scavenging_); |
| 261 return end_ < to_->end(); | 262 return end_ < to_->end(); |
| 262 } | 263 } |
| 263 | 264 |
| 264 void UpdateMaxHeapCapacity(); | 265 void UpdateMaxHeapCapacity(); |
| 265 void UpdateMaxHeapUsage(); | 266 void UpdateMaxHeapUsage(); |
| 266 | 267 |
| 267 void ProcessWeakTables(); | 268 void ProcessWeakReferences(); |
| 268 | 269 |
| 269 intptr_t NewSizeInWords(intptr_t old_size_in_words) const; | 270 intptr_t NewSizeInWords(intptr_t old_size_in_words) const; |
| 270 | 271 |
| 271 // Current allocation top and end. These values are being accessed directly | 272 // Current allocation top and end. These values are being accessed directly |
| 272 // from generated code. | 273 // from generated code. |
| 273 uword top_; | 274 uword top_; |
| 274 uword end_; | 275 uword end_; |
| 275 | 276 |
| 276 SemiSpace* to_; | 277 SemiSpace* to_; |
| 277 | 278 |
| 278 Heap* heap_; | 279 Heap* heap_; |
| 279 | 280 |
| 280 // A pointer to the first unscanned object. Scanning completes when | 281 // A pointer to the first unscanned object. Scanning completes when |
| 281 // this value meets the allocation top. | 282 // this value meets the allocation top. |
| 282 uword resolved_top_; | 283 uword resolved_top_; |
| 283 | 284 |
| 284 // Objects below this address have survived a scavenge. | 285 // Objects below this address have survived a scavenge. |
| 285 uword survivor_end_; | 286 uword survivor_end_; |
| 286 | 287 |
| 287 intptr_t max_semi_capacity_in_words_; | 288 intptr_t max_semi_capacity_in_words_; |
| 288 | 289 |
| 289 // All object are aligned to this value. | 290 // All object are aligned to this value. |
| 290 uword object_alignment_; | 291 uword object_alignment_; |
| 291 | 292 |
| 292 // Keep track whether a scavenge is currently running. | 293 // Keep track whether a scavenge is currently running. |
| 293 bool scavenging_; | 294 bool scavenging_; |
| 294 | 295 |
| 296 // Keep track of pending weak properties discovered while scagenging. |
| 297 RawWeakProperty* delayed_weak_properties_; |
| 298 |
| 295 int64_t gc_time_micros_; | 299 int64_t gc_time_micros_; |
| 296 intptr_t collections_; | 300 intptr_t collections_; |
| 297 static const int kStatsHistoryCapacity = 2; | 301 static const int kStatsHistoryCapacity = 2; |
| 298 RingBuffer<ScavengeStats, kStatsHistoryCapacity> stats_history_; | 302 RingBuffer<ScavengeStats, kStatsHistoryCapacity> stats_history_; |
| 299 | 303 |
| 300 // The total size of external data associated with objects in this scavenger. | 304 // The total size of external data associated with objects in this scavenger. |
| 301 intptr_t external_size_; | 305 intptr_t external_size_; |
| 302 | 306 |
| 303 friend class ScavengerVisitor; | 307 friend class ScavengerVisitor; |
| 304 friend class ScavengerWeakVisitor; | 308 friend class ScavengerWeakVisitor; |
| 305 | 309 |
| 306 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 310 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
| 307 }; | 311 }; |
| 308 | 312 |
| 309 } // namespace dart | 313 } // namespace dart |
| 310 | 314 |
| 311 #endif // VM_SCAVENGER_H_ | 315 #endif // VM_SCAVENGER_H_ |
| OLD | NEW |