| 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/virtual_memory.h" | 10 #include "vm/virtual_memory.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 DECLARE_FLAG(bool, collect_code); | 14 DECLARE_FLAG(bool, collect_code); |
| 15 DECLARE_FLAG(bool, log_code_drop); | 15 DECLARE_FLAG(bool, log_code_drop); |
| 16 DECLARE_FLAG(bool, always_drop_code); |
| 16 | 17 |
| 17 // Forward declarations. | 18 // Forward declarations. |
| 18 class Heap; | 19 class Heap; |
| 19 class ObjectPointerVisitor; | 20 class ObjectPointerVisitor; |
| 20 | 21 |
| 21 // A page containing old generation objects. | 22 // A page containing old generation objects. |
| 22 class HeapPage { | 23 class HeapPage { |
| 23 public: | 24 public: |
| 24 enum PageType { | 25 enum PageType { |
| 25 kData = 0, | 26 kData = 0, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 bool IsValidAddress(uword addr) const { | 193 bool IsValidAddress(uword addr) const { |
| 193 return Contains(addr); | 194 return Contains(addr); |
| 194 } | 195 } |
| 195 | 196 |
| 196 void VisitObjects(ObjectVisitor* visitor) const; | 197 void VisitObjects(ObjectVisitor* visitor) const; |
| 197 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 198 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
| 198 | 199 |
| 199 RawObject* FindObject(FindObjectVisitor* visitor, | 200 RawObject* FindObject(FindObjectVisitor* visitor, |
| 200 HeapPage::PageType type) const; | 201 HeapPage::PageType type) const; |
| 201 | 202 |
| 202 // Runs a visitor that attempts to drop references to code that has not | 203 // Checks if enough time has elapsed since the last attempt to collect |
| 203 // been run in awhile. | 204 // code. |
| 204 void TryDetachingCode(); | 205 bool ShouldCollectCode(); |
| 205 | 206 |
| 206 // Collect the garbage in the page space using mark-sweep. | 207 // Collect the garbage in the page space using mark-sweep. |
| 207 void MarkSweep(bool invoke_api_callbacks); | 208 void MarkSweep(bool invoke_api_callbacks); |
| 208 | 209 |
| 209 void StartEndAddress(uword* start, uword* end) const; | 210 void StartEndAddress(uword* start, uword* end) const; |
| 210 | 211 |
| 211 void SetGrowthControlState(bool state) { | 212 void SetGrowthControlState(bool state) { |
| 212 page_space_controller_.set_is_enabled(state); | 213 page_space_controller_.set_is_enabled(state); |
| 213 } | 214 } |
| 214 | 215 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 PageSpaceController page_space_controller_; | 268 PageSpaceController page_space_controller_; |
| 268 | 269 |
| 269 friend class PageSpaceController; | 270 friend class PageSpaceController; |
| 270 | 271 |
| 271 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 272 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 272 }; | 273 }; |
| 273 | 274 |
| 274 } // namespace dart | 275 } // namespace dart |
| 275 | 276 |
| 276 #endif // VM_PAGES_H_ | 277 #endif // VM_PAGES_H_ |
| OLD | NEW |