| 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 // An aligned page containing old generation objects. Alignment is used to be | 22 // An aligned page containing old generation objects. Alignment is used to be |
| 22 // able to get to a HeapPage header quickly based on a pointer to an object. | 23 // able to get to a HeapPage header quickly based on a pointer to an object. |
| 23 class HeapPage { | 24 class HeapPage { |
| 24 public: | 25 public: |
| 25 enum PageType { | 26 enum PageType { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 bool IsValidAddress(uword addr) const { | 194 bool IsValidAddress(uword addr) const { |
| 194 return Contains(addr); | 195 return Contains(addr); |
| 195 } | 196 } |
| 196 | 197 |
| 197 void VisitObjects(ObjectVisitor* visitor) const; | 198 void VisitObjects(ObjectVisitor* visitor) const; |
| 198 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 199 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
| 199 | 200 |
| 200 RawObject* FindObject(FindObjectVisitor* visitor, | 201 RawObject* FindObject(FindObjectVisitor* visitor, |
| 201 HeapPage::PageType type) const; | 202 HeapPage::PageType type) const; |
| 202 | 203 |
| 203 // Runs a visitor that attempts to drop references to code that has not | 204 // Checks if enough time has elapsed since the last attempt to collect |
| 204 // been run in awhile. | 205 // code. |
| 205 void TryDetachingCode(); | 206 bool ShouldTryCollectingCode(); |
| 206 | 207 |
| 207 // Collect the garbage in the page space using mark-sweep. | 208 // Collect the garbage in the page space using mark-sweep. |
| 208 void MarkSweep(bool invoke_api_callbacks); | 209 void MarkSweep(bool invoke_api_callbacks); |
| 209 | 210 |
| 210 void StartEndAddress(uword* start, uword* end) const; | 211 void StartEndAddress(uword* start, uword* end) const; |
| 211 | 212 |
| 212 void SetGrowthControlState(bool state) { | 213 void SetGrowthControlState(bool state) { |
| 213 page_space_controller_.set_is_enabled(state); | 214 page_space_controller_.set_is_enabled(state); |
| 214 } | 215 } |
| 215 | 216 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 PageSpaceController page_space_controller_; | 269 PageSpaceController page_space_controller_; |
| 269 | 270 |
| 270 friend class PageSpaceController; | 271 friend class PageSpaceController; |
| 271 | 272 |
| 272 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 273 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 273 }; | 274 }; |
| 274 | 275 |
| 275 } // namespace dart | 276 } // namespace dart |
| 276 | 277 |
| 277 #endif // VM_PAGES_H_ | 278 #endif // VM_PAGES_H_ |
| OLD | NEW |