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/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/utils.h" | 10 #include "vm/utils.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } | 63 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } |
64 | 64 |
65 intptr_t in_use() const { return (top_ - FirstObjectStart()); } | 65 intptr_t in_use() const { return (top_ - FirstObjectStart()); } |
66 | 66 |
67 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 67 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
68 | 68 |
69 private: | 69 private: |
70 uword FirstObjectStart() const { return to_->start() | object_alignment_; } | 70 uword FirstObjectStart() const { return to_->start() | object_alignment_; } |
71 void Prologue(); | 71 void Prologue(); |
72 void IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor); | 72 void IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor); |
| 73 void IterateWeakRoots(Isolate* isolate, ObjectPointerVisitor* visitor); |
73 void ProcessToSpace(ObjectPointerVisitor* visitor); | 74 void ProcessToSpace(ObjectPointerVisitor* visitor); |
74 void Epilogue(); | 75 void Epilogue(); |
75 | 76 |
76 VirtualMemory* space_; | 77 VirtualMemory* space_; |
77 MemoryRegion* to_; | 78 MemoryRegion* to_; |
78 MemoryRegion* from_; | 79 MemoryRegion* from_; |
79 | 80 |
80 Heap* heap_; | 81 Heap* heap_; |
81 | 82 |
82 // Current allocation top and end. These values are being accessed directly | 83 // Current allocation top and end. These values are being accessed directly |
83 // from generated code. | 84 // from generated code. |
84 uword top_; | 85 uword top_; |
85 uword end_; | 86 uword end_; |
86 | 87 |
87 // All object are aligned to this value. | 88 // All object are aligned to this value. |
88 uword object_alignment_; | 89 uword object_alignment_; |
89 | 90 |
90 // Scavenge cycle count. | 91 // Scavenge cycle count. |
91 int count_; | 92 int count_; |
92 // Keep track whether a scavenge is currently running. | 93 // Keep track whether a scavenge is currently running. |
93 bool scavenging_; | 94 bool scavenging_; |
94 | 95 |
95 friend class ScavengerVisitor; | 96 friend class ScavengerVisitor; |
| 97 friend class ScavengerWeakVisitor; |
96 | 98 |
97 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 99 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
98 }; | 100 }; |
99 | 101 |
100 } // namespace dart | 102 } // namespace dart |
101 | 103 |
102 #endif // VM_SCAVENGER_H_ | 104 #endif // VM_SCAVENGER_H_ |
OLD | NEW |