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" |
11 #include "vm/globals.h" | 11 #include "vm/globals.h" |
12 #include "vm/raw_object.h" | 12 #include "vm/raw_object.h" |
| 13 #include "vm/spaces.h" |
13 #include "vm/virtual_memory.h" | 14 #include "vm/virtual_memory.h" |
14 #include "vm/visitor.h" | 15 #include "vm/visitor.h" |
15 | 16 |
16 namespace dart { | 17 namespace dart { |
17 | 18 |
18 // Forward declarations. | 19 // Forward declarations. |
19 class Heap; | 20 class Heap; |
20 class Isolate; | 21 class Isolate; |
21 class JSONObject; | 22 class JSONObject; |
22 class ScavengerVisitor; | 23 class ScavengerVisitor; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 75 |
75 intptr_t UsedInWords() const { | 76 intptr_t UsedInWords() const { |
76 return (top_ - FirstObjectStart()) >> kWordSizeLog2; | 77 return (top_ - FirstObjectStart()) >> kWordSizeLog2; |
77 } | 78 } |
78 intptr_t CapacityInWords() const { | 79 intptr_t CapacityInWords() const { |
79 return (end_ - FirstObjectStart()) >> kWordSizeLog2; | 80 return (end_ - FirstObjectStart()) >> kWordSizeLog2; |
80 } | 81 } |
81 intptr_t ExternalInWords() const { | 82 intptr_t ExternalInWords() const { |
82 return external_size_ >> kWordSizeLog2; | 83 return external_size_ >> kWordSizeLog2; |
83 } | 84 } |
| 85 SpaceUsage GetCurrentUsage() const { |
| 86 SpaceUsage usage; |
| 87 usage.used_in_words = UsedInWords(); |
| 88 usage.capacity_in_words = CapacityInWords(); |
| 89 usage.external_in_words = ExternalInWords(); |
| 90 return usage; |
| 91 } |
84 | 92 |
85 void VisitObjects(ObjectVisitor* visitor) const; | 93 void VisitObjects(ObjectVisitor* visitor) const; |
86 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 94 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
87 | 95 |
88 void StartEndAddress(uword* start, uword* end) const { | 96 void StartEndAddress(uword* start, uword* end) const { |
89 *start = to_->start(); | 97 *start = to_->start(); |
90 *end = to_->end(); | 98 *end = to_->end(); |
91 } | 99 } |
92 | 100 |
93 // Returns true if the last scavenge had a promotion failure. | 101 // Returns true if the last scavenge had a promotion failure. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 220 |
213 friend class ScavengerVisitor; | 221 friend class ScavengerVisitor; |
214 friend class ScavengerWeakVisitor; | 222 friend class ScavengerWeakVisitor; |
215 | 223 |
216 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 224 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
217 }; | 225 }; |
218 | 226 |
219 } // namespace dart | 227 } // namespace dart |
220 | 228 |
221 #endif // VM_SCAVENGER_H_ | 229 #endif // VM_SCAVENGER_H_ |
OLD | NEW |