| 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/ring_buffer.h" |
| 10 #include "vm/spaces.h" | 11 #include "vm/spaces.h" |
| 11 #include "vm/virtual_memory.h" | 12 #include "vm/virtual_memory.h" |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 15 DECLARE_FLAG(bool, collect_code); | 16 DECLARE_FLAG(bool, collect_code); |
| 16 DECLARE_FLAG(bool, log_code_drop); | 17 DECLARE_FLAG(bool, log_code_drop); |
| 17 DECLARE_FLAG(bool, always_drop_code); | 18 DECLARE_FLAG(bool, always_drop_code); |
| 18 | 19 |
| 19 // Forward declarations. | 20 // Forward declarations. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 82 |
| 82 DISALLOW_ALLOCATION(); | 83 DISALLOW_ALLOCATION(); |
| 83 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapPage); | 84 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapPage); |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 | 87 |
| 87 // The history holds the timing information of the last garbage collection | 88 // The history holds the timing information of the last garbage collection |
| 88 // runs. | 89 // runs. |
| 89 class PageSpaceGarbageCollectionHistory { | 90 class PageSpaceGarbageCollectionHistory { |
| 90 public: | 91 public: |
| 91 PageSpaceGarbageCollectionHistory(); | 92 PageSpaceGarbageCollectionHistory() {} |
| 92 ~PageSpaceGarbageCollectionHistory() {} | 93 ~PageSpaceGarbageCollectionHistory() {} |
| 93 | 94 |
| 94 void AddGarbageCollectionTime(int64_t start, int64_t end); | 95 void AddGarbageCollectionTime(int64_t start, int64_t end); |
| 95 | 96 |
| 96 int GarbageCollectionTimeFraction(); | 97 int GarbageCollectionTimeFraction(); |
| 97 | 98 |
| 98 private: | 99 private: |
| 100 struct Entry { |
| 101 int64_t start; |
| 102 int64_t end; |
| 103 }; |
| 99 static const intptr_t kHistoryLength = 4; | 104 static const intptr_t kHistoryLength = 4; |
| 100 int64_t start_[kHistoryLength]; | 105 RingBuffer<Entry, kHistoryLength> history_; |
| 101 int64_t end_[kHistoryLength]; | |
| 102 intptr_t index_; | |
| 103 | 106 |
| 104 DISALLOW_ALLOCATION(); | 107 DISALLOW_ALLOCATION(); |
| 105 DISALLOW_COPY_AND_ASSIGN(PageSpaceGarbageCollectionHistory); | 108 DISALLOW_COPY_AND_ASSIGN(PageSpaceGarbageCollectionHistory); |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 | 111 |
| 109 // If GC is able to reclaim more than heap_growth_ratio (in percent) memory | 112 // If GC is able to reclaim more than heap_growth_ratio (in percent) memory |
| 110 // and if the relative GC time is below a given threshold, | 113 // and if the relative GC time is below a given threshold, |
| 111 // then the heap is not grown when the next GC decision is made. | 114 // then the heap is not grown when the next GC decision is made. |
| 112 // PageSpaceController controls the heap size. | 115 // PageSpaceController controls the heap size. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 intptr_t collections_; | 325 intptr_t collections_; |
| 323 | 326 |
| 324 friend class PageSpaceController; | 327 friend class PageSpaceController; |
| 325 | 328 |
| 326 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 329 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 327 }; | 330 }; |
| 328 | 331 |
| 329 } // namespace dart | 332 } // namespace dart |
| 330 | 333 |
| 331 #endif // VM_PAGES_H_ | 334 #endif // VM_PAGES_H_ |
| OLD | NEW |