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