| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 intptr_t in_use() const { return (top_ - FirstObjectStart()); } | 71 intptr_t in_use() const { return (top_ - FirstObjectStart()); } |
| 72 | 72 |
| 73 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 73 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 uword FirstObjectStart() const { return to_->start() | object_alignment_; } | 76 uword FirstObjectStart() const { return to_->start() | object_alignment_; } |
| 77 void Prologue(Isolate* isolate, bool invoke_api_callbacks); | 77 void Prologue(Isolate* isolate, bool invoke_api_callbacks); |
| 78 void IterateRoots(Isolate* isolate, | 78 void IterateRoots(Isolate* isolate, |
| 79 ObjectPointerVisitor* visitor, | 79 ObjectPointerVisitor* visitor, |
| 80 bool visit_prologue_weak_persistent_handles); | 80 bool visit_prologue_weak_persistent_handles); |
| 81 void IterateWeakReferences(Isolate* isolate, ObjectPointerVisitor* visitor); |
| 81 void IterateWeakRoots(Isolate* isolate, | 82 void IterateWeakRoots(Isolate* isolate, |
| 82 HandleVisitor* visitor, | 83 HandleVisitor* visitor, |
| 83 bool visit_prologue_weak_persistent_handles); | 84 bool visit_prologue_weak_persistent_handles); |
| 84 void ProcessToSpace(ObjectPointerVisitor* visitor); | 85 void ProcessToSpace(ObjectPointerVisitor* visitor); |
| 85 void Epilogue(Isolate* isolate, bool invoke_api_callbacks); | 86 void Epilogue(Isolate* isolate, bool invoke_api_callbacks); |
| 86 | 87 |
| 88 bool IsUnreachable(RawObject** p); |
| 89 |
| 87 // During a scavenge we need to remember the promoted objects. | 90 // During a scavenge we need to remember the promoted objects. |
| 88 // This is implemented as a stack of objects at the end of the to space. As | 91 // This is implemented as a stack of objects at the end of the to space. As |
| 89 // object sizes are always greater than sizeof(uword) and promoted objects do | 92 // object sizes are always greater than sizeof(uword) and promoted objects do |
| 90 // not consume space in the to space they leave enough room for this stack. | 93 // not consume space in the to space they leave enough room for this stack. |
| 91 void PushToPromotedStack(uword addr) { | 94 void PushToPromotedStack(uword addr) { |
| 92 end_ -= sizeof(addr); | 95 end_ -= sizeof(addr); |
| 93 ASSERT(end_ > top_); | 96 ASSERT(end_ > top_); |
| 94 *reinterpret_cast<uword*>(end_) = addr; | 97 *reinterpret_cast<uword*>(end_) = addr; |
| 95 } | 98 } |
| 96 uword PopFromPromotedStack() { | 99 uword PopFromPromotedStack() { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 132 |
| 130 friend class ScavengerVisitor; | 133 friend class ScavengerVisitor; |
| 131 friend class ScavengerWeakVisitor; | 134 friend class ScavengerWeakVisitor; |
| 132 | 135 |
| 133 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 136 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
| 134 }; | 137 }; |
| 135 | 138 |
| 136 } // namespace dart | 139 } // namespace dart |
| 137 | 140 |
| 138 #endif // VM_SCAVENGER_H_ | 141 #endif // VM_SCAVENGER_H_ |
| OLD | NEW |