| 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/dart.h" |
| 10 #include "vm/flags.h" | 11 #include "vm/flags.h" |
| 11 #include "vm/globals.h" | 12 #include "vm/globals.h" |
| 12 #include "vm/raw_object.h" | 13 #include "vm/raw_object.h" |
| 13 #include "vm/spaces.h" | 14 #include "vm/spaces.h" |
| 14 #include "vm/virtual_memory.h" | 15 #include "vm/virtual_memory.h" |
| 15 #include "vm/visitor.h" | 16 #include "vm/visitor.h" |
| 16 | 17 |
| 17 namespace dart { | 18 namespace dart { |
| 18 | 19 |
| 19 // Forward declarations. | 20 // Forward declarations. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 38 // least unless it is debugging code. This might need to be relaxed later, | 39 // least unless it is debugging code. This might need to be relaxed later, |
| 39 // but currently it helps prevent dumb bugs. | 40 // but currently it helps prevent dumb bugs. |
| 40 ASSERT(!from_->Contains(addr)); | 41 ASSERT(!from_->Contains(addr)); |
| 41 return to_->Contains(addr); | 42 return to_->Contains(addr); |
| 42 } | 43 } |
| 43 | 44 |
| 44 RawObject* FindObject(FindObjectVisitor* visitor) const; | 45 RawObject* FindObject(FindObjectVisitor* visitor) const; |
| 45 | 46 |
| 46 uword TryAllocate(intptr_t size) { | 47 uword TryAllocate(intptr_t size) { |
| 47 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 48 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
| 49 ASSERT(heap_ != Dart::vm_isolate()->heap()); |
| 48 #if defined(DEBUG) | 50 #if defined(DEBUG) |
| 49 if (FLAG_gc_at_alloc && !scavenging_) { | 51 if (FLAG_gc_at_alloc && !scavenging_) { |
| 50 Scavenge(); | 52 Scavenge(); |
| 51 } | 53 } |
| 52 #endif | 54 #endif |
| 53 uword result = top_; | 55 uword result = top_; |
| 54 intptr_t remaining = end_ - top_; | 56 intptr_t remaining = end_ - top_; |
| 55 if (remaining < size) { | 57 if (remaining < size) { |
| 56 return 0; | 58 return 0; |
| 57 } | 59 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 215 |
| 214 friend class ScavengerVisitor; | 216 friend class ScavengerVisitor; |
| 215 friend class ScavengerWeakVisitor; | 217 friend class ScavengerWeakVisitor; |
| 216 | 218 |
| 217 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 219 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
| 218 }; | 220 }; |
| 219 | 221 |
| 220 } // namespace dart | 222 } // namespace dart |
| 221 | 223 |
| 222 #endif // VM_SCAVENGER_H_ | 224 #endif // VM_SCAVENGER_H_ |
| OLD | NEW |