| 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 RUNTIME_VM_SCAVENGER_H_ | 5 #ifndef RUNTIME_VM_SCAVENGER_H_ |
| 6 #define RUNTIME_VM_SCAVENGER_H_ | 6 #define RUNTIME_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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 top_ += size; | 142 top_ += size; |
| 143 ASSERT(to_->Contains(top_) || (top_ == to_->end())); | 143 ASSERT(to_->Contains(top_) || (top_ == to_->end())); |
| 144 return result; | 144 return result; |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Collect the garbage in this scavenger. | 147 // Collect the garbage in this scavenger. |
| 148 void Scavenge(); | 148 void Scavenge(); |
| 149 void Scavenge(bool invoke_api_callbacks); | 149 void Scavenge(bool invoke_api_callbacks); |
| 150 | 150 |
| 151 // Promote all live objects. | 151 // Promote all live objects. |
| 152 void Evacuate() { | 152 void Evacuate(); |
| 153 Scavenge(); | |
| 154 Scavenge(); | |
| 155 ASSERT(UsedInWords() == 0); | |
| 156 } | |
| 157 | 153 |
| 158 // Accessors to generate code for inlined allocation. | 154 // Accessors to generate code for inlined allocation. |
| 159 uword* TopAddress() { return &top_; } | 155 uword* TopAddress() { return &top_; } |
| 160 uword* EndAddress() { return &end_; } | 156 uword* EndAddress() { return &end_; } |
| 161 static intptr_t top_offset() { return OFFSET_OF(Scavenger, top_); } | 157 static intptr_t top_offset() { return OFFSET_OF(Scavenger, top_); } |
| 162 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } | 158 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } |
| 163 | 159 |
| 164 int64_t UsedInWords() const { | 160 int64_t UsedInWords() const { |
| 165 return (top_ - FirstObjectStart()) >> kWordSizeLog2; | 161 return (top_ - FirstObjectStart()) >> kWordSizeLog2; |
| 166 } | 162 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 RawWeakProperty* delayed_weak_properties_; | 286 RawWeakProperty* delayed_weak_properties_; |
| 291 | 287 |
| 292 int64_t gc_time_micros_; | 288 int64_t gc_time_micros_; |
| 293 intptr_t collections_; | 289 intptr_t collections_; |
| 294 static const int kStatsHistoryCapacity = 2; | 290 static const int kStatsHistoryCapacity = 2; |
| 295 RingBuffer<ScavengeStats, kStatsHistoryCapacity> stats_history_; | 291 RingBuffer<ScavengeStats, kStatsHistoryCapacity> stats_history_; |
| 296 | 292 |
| 297 // The total size of external data associated with objects in this scavenger. | 293 // The total size of external data associated with objects in this scavenger. |
| 298 intptr_t external_size_; | 294 intptr_t external_size_; |
| 299 | 295 |
| 296 bool failed_to_promote_; |
| 297 |
| 300 friend class ScavengerVisitor; | 298 friend class ScavengerVisitor; |
| 301 friend class ScavengerWeakVisitor; | 299 friend class ScavengerWeakVisitor; |
| 302 | 300 |
| 303 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 301 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
| 304 }; | 302 }; |
| 305 | 303 |
| 306 } // namespace dart | 304 } // namespace dart |
| 307 | 305 |
| 308 #endif // RUNTIME_VM_SCAVENGER_H_ | 306 #endif // RUNTIME_VM_SCAVENGER_H_ |
| OLD | NEW |