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 <map> | 8 #include <map> |
9 | 9 |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 ASSERT(to_->Contains(result)); | 56 ASSERT(to_->Contains(result)); |
57 ASSERT((result & kObjectAlignmentMask) == object_alignment_); | 57 ASSERT((result & kObjectAlignmentMask) == object_alignment_); |
58 | 58 |
59 top_ += size; | 59 top_ += size; |
60 ASSERT(to_->Contains(top_) || (top_ == to_->end())); | 60 ASSERT(to_->Contains(top_) || (top_ == to_->end())); |
61 return result; | 61 return result; |
62 } | 62 } |
63 | 63 |
64 // Collect the garbage in this scavenger. | 64 // Collect the garbage in this scavenger. |
65 void Scavenge(const char* gc_reason); | 65 void Scavenge(); |
66 void Scavenge(bool invoke_api_callbacks, const char* gc_reason); | 66 void Scavenge(bool invoke_api_callbacks); |
67 | 67 |
68 // Accessors to generate code for inlined allocation. | 68 // Accessors to generate code for inlined allocation. |
69 uword* TopAddress() { return &top_; } | 69 uword* TopAddress() { return &top_; } |
70 uword* EndAddress() { return &end_; } | 70 uword* EndAddress() { return &end_; } |
71 static intptr_t top_offset() { return OFFSET_OF(Scavenger, top_); } | 71 static intptr_t top_offset() { return OFFSET_OF(Scavenger, top_); } |
72 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } | 72 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } |
73 | 73 |
74 intptr_t in_use() const { return (top_ - FirstObjectStart()); } | 74 intptr_t in_use() const { return (top_ - FirstObjectStart()); } |
75 intptr_t capacity() const { return space_->size(); } | 75 intptr_t capacity() const { return space_->size(); } |
76 | 76 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // A pointer to the first unscanned object. Scanning completes when | 152 // A pointer to the first unscanned object. Scanning completes when |
153 // this value meets the allocation top. | 153 // this value meets the allocation top. |
154 uword resolved_top_; | 154 uword resolved_top_; |
155 | 155 |
156 // Objects below this address have survived a scavenge. | 156 // Objects below this address have survived a scavenge. |
157 uword survivor_end_; | 157 uword survivor_end_; |
158 | 158 |
159 // All object are aligned to this value. | 159 // All object are aligned to this value. |
160 uword object_alignment_; | 160 uword object_alignment_; |
161 | 161 |
162 // Scavenge cycle count. | |
163 int count_; | |
164 // Keep track whether a scavenge is currently running. | 162 // Keep track whether a scavenge is currently running. |
165 bool scavenging_; | 163 bool scavenging_; |
166 // Keep track whether the scavenge had a promotion failure. | 164 // Keep track whether the scavenge had a promotion failure. |
167 bool had_promotion_failure_; | 165 bool had_promotion_failure_; |
168 | 166 |
169 friend class ScavengerVisitor; | 167 friend class ScavengerVisitor; |
170 friend class ScavengerWeakVisitor; | 168 friend class ScavengerWeakVisitor; |
171 | 169 |
172 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 170 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
173 }; | 171 }; |
174 | 172 |
175 } // namespace dart | 173 } // namespace dart |
176 | 174 |
177 #endif // VM_SCAVENGER_H_ | 175 #endif // VM_SCAVENGER_H_ |
OLD | NEW |