| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } | 68 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } |
| 69 | 69 |
| 70 intptr_t in_use() const { return (top_ - FirstObjectStart()); } | 70 intptr_t in_use() const { return (top_ - FirstObjectStart()); } |
| 71 | 71 |
| 72 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 72 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 uword FirstObjectStart() const { return to_->start() | object_alignment_; } | 75 uword FirstObjectStart() const { return to_->start() | object_alignment_; } |
| 76 void Prologue(); | 76 void Prologue(); |
| 77 void IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor); | 77 void IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor); |
| 78 void IterateWeakRoots(Isolate* isolate, ObjectPointerVisitor* visitor); | 78 void IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor); |
| 79 void ProcessToSpace(ObjectPointerVisitor* visitor); | 79 void ProcessToSpace(ObjectPointerVisitor* visitor); |
| 80 void Epilogue(); | 80 void Epilogue(); |
| 81 | 81 |
| 82 // During a scavenge we need to remember the promoted objects. | 82 // During a scavenge we need to remember the promoted objects. |
| 83 // This is implemented as a stack of objects at the end of the to space. As | 83 // This is implemented as a stack of objects at the end of the to space. As |
| 84 // object sizes are always greater than sizeof(uword) and promoted objects do | 84 // object sizes are always greater than sizeof(uword) and promoted objects do |
| 85 // not consume space in the to space they leave enough room for this stack. | 85 // not consume space in the to space they leave enough room for this stack. |
| 86 void PushToPromotedStack(uword addr) { | 86 void PushToPromotedStack(uword addr) { |
| 87 end_ -= sizeof(addr); | 87 end_ -= sizeof(addr); |
| 88 ASSERT(end_ > top_); | 88 ASSERT(end_ > top_); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 friend class ScavengerVisitor; | 125 friend class ScavengerVisitor; |
| 126 friend class ScavengerWeakVisitor; | 126 friend class ScavengerWeakVisitor; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 128 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 } // namespace dart | 131 } // namespace dart |
| 132 | 132 |
| 133 #endif // VM_SCAVENGER_H_ | 133 #endif // VM_SCAVENGER_H_ |
| OLD | NEW |