OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_PAGES_H_ | 5 #ifndef VM_PAGES_H_ |
6 #define VM_PAGES_H_ | 6 #define VM_PAGES_H_ |
7 | 7 |
8 #include "vm/freelist.h" | 8 #include "vm/freelist.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
11 #include "vm/ring_buffer.h" | 11 #include "vm/ring_buffer.h" |
12 #include "vm/spaces.h" | 12 #include "vm/spaces.h" |
13 #include "vm/thread.h" | 13 #include "vm/thread.h" |
14 #include "vm/virtual_memory.h" | 14 #include "vm/virtual_memory.h" |
15 | 15 |
16 namespace dart { | 16 namespace dart { |
17 | 17 |
18 DECLARE_FLAG(bool, log_code_drop); | 18 DECLARE_FLAG(bool, log_code_drop); |
19 DECLARE_FLAG(bool, always_drop_code); | 19 DECLARE_FLAG(bool, always_drop_code); |
20 DECLARE_FLAG(bool, write_protect_code); | 20 DECLARE_FLAG(bool, write_protect_code); |
21 | 21 |
22 // Forward declarations. | 22 // Forward declarations. |
23 class Heap; | 23 class Heap; |
24 class JSONObject; | 24 class JSONObject; |
25 class ObjectPointerVisitor; | 25 class ObjectPointerVisitor; |
| 26 class ObjectSet; |
26 | 27 |
27 // A page containing old generation objects. | 28 // A page containing old generation objects. |
28 class HeapPage { | 29 class HeapPage { |
29 public: | 30 public: |
30 enum PageType { | 31 enum PageType { |
31 kData = 0, | 32 kData = 0, |
32 kExecutable, | 33 kExecutable, |
33 kReadOnlyData, | 34 kReadOnlyData, |
34 kNumPageTypes | 35 kNumPageTypes |
35 }; | 36 }; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 RawObject* FindObject(FindObjectVisitor* visitor, | 263 RawObject* FindObject(FindObjectVisitor* visitor, |
263 HeapPage::PageType type) const; | 264 HeapPage::PageType type) const; |
264 | 265 |
265 // Checks if enough time has elapsed since the last attempt to collect | 266 // Checks if enough time has elapsed since the last attempt to collect |
266 // code. | 267 // code. |
267 bool ShouldCollectCode(); | 268 bool ShouldCollectCode(); |
268 | 269 |
269 // Collect the garbage in the page space using mark-sweep. | 270 // Collect the garbage in the page space using mark-sweep. |
270 void MarkSweep(bool invoke_api_callbacks); | 271 void MarkSweep(bool invoke_api_callbacks); |
271 | 272 |
272 void StartEndAddress(uword* start, uword* end) const; | 273 void AddRegionsToObjectSet(ObjectSet* set) const; |
273 | 274 |
274 void InitGrowthControl() { | 275 void InitGrowthControl() { |
275 page_space_controller_.set_last_usage(usage_); | 276 page_space_controller_.set_last_usage(usage_); |
276 page_space_controller_.Enable(); | 277 page_space_controller_.Enable(); |
277 } | 278 } |
278 | 279 |
279 void SetGrowthControlState(bool state) { | 280 void SetGrowthControlState(bool state) { |
280 if (state) { | 281 if (state) { |
281 page_space_controller_.Enable(); | 282 page_space_controller_.Enable(); |
282 } else { | 283 } else { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 friend class HeapIterationScope; | 457 friend class HeapIterationScope; |
457 friend class PageSpaceController; | 458 friend class PageSpaceController; |
458 friend class SweeperTask; | 459 friend class SweeperTask; |
459 | 460 |
460 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 461 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
461 }; | 462 }; |
462 | 463 |
463 } // namespace dart | 464 } // namespace dart |
464 | 465 |
465 #endif // VM_PAGES_H_ | 466 #endif // VM_PAGES_H_ |
OLD | NEW |