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/dart.h" |
11 #include "vm/flags.h" | 11 #include "vm/flags.h" |
12 #include "vm/globals.h" | 12 #include "vm/globals.h" |
13 #include "vm/raw_object.h" | 13 #include "vm/raw_object.h" |
14 #include "vm/ring_buffer.h" | 14 #include "vm/ring_buffer.h" |
15 #include "vm/spaces.h" | 15 #include "vm/spaces.h" |
16 #include "vm/virtual_memory.h" | 16 #include "vm/virtual_memory.h" |
17 #include "vm/visitor.h" | 17 #include "vm/visitor.h" |
18 | 18 |
19 namespace dart { | 19 namespace dart { |
20 | 20 |
21 // Forward declarations. | 21 // Forward declarations. |
22 class Heap; | 22 class Heap; |
23 class Isolate; | 23 class Isolate; |
24 class JSONObject; | 24 class JSONObject; |
| 25 class ObjectSet; |
25 class ScavengerVisitor; | 26 class ScavengerVisitor; |
26 | 27 |
27 // Wrapper around VirtualMemory that adds caching and handles the empty case. | 28 // Wrapper around VirtualMemory that adds caching and handles the empty case. |
28 class SemiSpace { | 29 class SemiSpace { |
29 public: | 30 public: |
30 static void InitOnce(); | 31 static void InitOnce(); |
31 | 32 |
32 // Get a space of the given size. Returns NULL on out of memory. If size is 0, | 33 // Get a space of the given size. Returns NULL on out of memory. If size is 0, |
33 // returns an empty space: pointer(), start() and end() all return NULL. | 34 // returns an empty space: pointer(), start() and end() all return NULL. |
34 static SemiSpace* New(intptr_t size_in_words); | 35 static SemiSpace* New(intptr_t size_in_words); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 SpaceUsage usage; | 175 SpaceUsage usage; |
175 usage.used_in_words = UsedInWords(); | 176 usage.used_in_words = UsedInWords(); |
176 usage.capacity_in_words = CapacityInWords(); | 177 usage.capacity_in_words = CapacityInWords(); |
177 usage.external_in_words = ExternalInWords(); | 178 usage.external_in_words = ExternalInWords(); |
178 return usage; | 179 return usage; |
179 } | 180 } |
180 | 181 |
181 void VisitObjects(ObjectVisitor* visitor) const; | 182 void VisitObjects(ObjectVisitor* visitor) const; |
182 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 183 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
183 | 184 |
184 void StartEndAddress(uword* start, uword* end) const { | 185 void AddRegionsToObjectSet(ObjectSet* set) const; |
185 *start = to_->start(); | |
186 *end = to_->end(); | |
187 } | |
188 | 186 |
189 void WriteProtect(bool read_only); | 187 void WriteProtect(bool read_only); |
190 | 188 |
191 void AddGCTime(int64_t micros) { | 189 void AddGCTime(int64_t micros) { |
192 gc_time_micros_ += micros; | 190 gc_time_micros_ += micros; |
193 } | 191 } |
194 | 192 |
195 int64_t gc_time_micros() const { | 193 int64_t gc_time_micros() const { |
196 return gc_time_micros_; | 194 return gc_time_micros_; |
197 } | 195 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 306 |
309 friend class ScavengerVisitor; | 307 friend class ScavengerVisitor; |
310 friend class ScavengerWeakVisitor; | 308 friend class ScavengerWeakVisitor; |
311 | 309 |
312 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 310 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
313 }; | 311 }; |
314 | 312 |
315 } // namespace dart | 313 } // namespace dart |
316 | 314 |
317 #endif // VM_SCAVENGER_H_ | 315 #endif // VM_SCAVENGER_H_ |
OLD | NEW |