| 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 "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "platform/utils.h" | 9 #include "platform/utils.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // During a scavenge this function only returns true for addresses that will | 33 // During a scavenge this function only returns true for addresses that will |
| 34 // be part of the surviving objects. | 34 // be part of the surviving objects. |
| 35 bool Contains(uword addr) const { | 35 bool Contains(uword addr) const { |
| 36 // No reasonable algorithm should be checking for objects in from space. At | 36 // No reasonable algorithm should be checking for objects in from space. At |
| 37 // least unless it is debugging code. This might need to be relaxed later, | 37 // least unless it is debugging code. This might need to be relaxed later, |
| 38 // but currently it helps prevent dumb bugs. | 38 // but currently it helps prevent dumb bugs. |
| 39 ASSERT(!from_->Contains(addr)); | 39 ASSERT(!from_->Contains(addr)); |
| 40 return to_->Contains(addr); | 40 return to_->Contains(addr); |
| 41 } | 41 } |
| 42 | 42 |
| 43 RawObject* FindObject(FindObjectVisitor* visitor) const; |
| 44 |
| 43 uword TryAllocate(intptr_t size) { | 45 uword TryAllocate(intptr_t size) { |
| 44 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 46 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
| 45 #if defined(DEBUG) | 47 #if defined(DEBUG) |
| 46 if (FLAG_gc_at_alloc && !scavenging_) { | 48 if (FLAG_gc_at_alloc && !scavenging_) { |
| 47 Scavenge(); | 49 Scavenge(); |
| 48 } | 50 } |
| 49 #endif | 51 #endif |
| 50 uword result = top_; | 52 uword result = top_; |
| 51 intptr_t remaining = end_ - top_; | 53 intptr_t remaining = end_ - top_; |
| 52 if (remaining < size) { | 54 if (remaining < size) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 216 |
| 215 friend class ScavengerVisitor; | 217 friend class ScavengerVisitor; |
| 216 friend class ScavengerWeakVisitor; | 218 friend class ScavengerWeakVisitor; |
| 217 | 219 |
| 218 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 220 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
| 219 }; | 221 }; |
| 220 | 222 |
| 221 } // namespace dart | 223 } // namespace dart |
| 222 | 224 |
| 223 #endif // VM_SCAVENGER_H_ | 225 #endif // VM_SCAVENGER_H_ |
| OLD | NEW |