| 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" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 int heap_growth_rate, | 111 int heap_growth_rate, |
| 112 int garbage_collection_time_ratio); | 112 int garbage_collection_time_ratio); |
| 113 ~PageSpaceController(); | 113 ~PageSpaceController(); |
| 114 | 114 |
| 115 bool CanGrowPageSpace(intptr_t size_in_bytes); | 115 bool CanGrowPageSpace(intptr_t size_in_bytes); |
| 116 | 116 |
| 117 // A garbage collection is considered as successful if more than | 117 // A garbage collection is considered as successful if more than |
| 118 // heap_growth_ratio % of memory got deallocated by the garbage collector. | 118 // heap_growth_ratio % of memory got deallocated by the garbage collector. |
| 119 // In this case garbage collection will be performed next time. Otherwise | 119 // In this case garbage collection will be performed next time. Otherwise |
| 120 // the heap will grow. | 120 // the heap will grow. |
| 121 void EvaluateGarbageCollection(size_t in_use_before, size_t in_use_after, | 121 void EvaluateGarbageCollection(intptr_t in_use_before, intptr_t in_use_after, |
| 122 int64_t start, int64_t end); | 122 int64_t start, int64_t end); |
| 123 | 123 |
| 124 void Enable() { | 124 void Enable() { |
| 125 is_enabled_ = true; | 125 is_enabled_ = true; |
| 126 } | 126 } |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 bool is_enabled_; | 129 bool is_enabled_; |
| 130 | 130 |
| 131 // Heap growth control variable. | 131 // Heap growth control variable. |
| 132 uword grow_heap_; | 132 uword grow_heap_; |
| 133 | 133 |
| 134 // If the garbage collector was not able to free more than heap_growth_ratio_ | 134 // If the garbage collector was not able to free more than heap_growth_ratio_ |
| 135 // memory, then the heap is grown. Otherwise garbage collection is performed. | 135 // memory, then the heap is grown. Otherwise garbage collection is performed. |
| 136 int heap_growth_ratio_; | 136 int heap_growth_ratio_; |
| 137 | 137 |
| 138 // The desired percent of heap in-use after a garbage collection. |
| 139 // Equivalent to \frac{100-heap_growth_ratio_}{100}. |
| 140 double desired_utilization_; |
| 141 |
| 138 // Number of pages we grow. | 142 // Number of pages we grow. |
| 139 int heap_growth_rate_; | 143 int heap_growth_rate_; |
| 140 | 144 |
| 141 // If the relative GC time stays below garbage_collection_time_ratio_ | 145 // If the relative GC time stays below garbage_collection_time_ratio_ |
| 142 // garbage collection can be performed. | 146 // garbage collection can be performed. |
| 143 int garbage_collection_time_ratio_; | 147 int garbage_collection_time_ratio_; |
| 144 | 148 |
| 145 PageSpaceGarbageCollectionHistory history_; | 149 PageSpaceGarbageCollectionHistory history_; |
| 146 | 150 |
| 147 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpaceController); | 151 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpaceController); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 bool sweeping_; | 248 bool sweeping_; |
| 245 | 249 |
| 246 PageSpaceController page_space_controller_; | 250 PageSpaceController page_space_controller_; |
| 247 | 251 |
| 248 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 252 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 249 }; | 253 }; |
| 250 | 254 |
| 251 } // namespace dart | 255 } // namespace dart |
| 252 | 256 |
| 253 #endif // VM_PAGES_H_ | 257 #endif // VM_PAGES_H_ |
| OLD | NEW |