| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); | 98 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); |
| 99 | 99 |
| 100 void AllocatePage(); | 100 void AllocatePage(); |
| 101 HeapPage* AllocateLargePage(intptr_t size); | 101 HeapPage* AllocateLargePage(intptr_t size); |
| 102 void FreeLargePage(HeapPage* page, HeapPage* previous_page); | 102 void FreeLargePage(HeapPage* page, HeapPage* previous_page); |
| 103 void FreePages(HeapPage* pages); | 103 void FreePages(HeapPage* pages); |
| 104 | 104 |
| 105 static intptr_t LargePageSizeFor(intptr_t size); |
| 106 bool CanIncreaseCapacity(intptr_t increase) { |
| 107 ASSERT(capacity_ < max_capacity_); |
| 108 return increase <= (max_capacity_ - capacity_); |
| 109 } |
| 110 |
| 105 uword TryBumpAllocate(intptr_t size); | 111 uword TryBumpAllocate(intptr_t size); |
| 106 | 112 |
| 107 FreeList freelist_; | 113 FreeList freelist_; |
| 108 | 114 |
| 109 Heap* heap_; | 115 Heap* heap_; |
| 110 | 116 |
| 111 HeapPage* pages_; | 117 HeapPage* pages_; |
| 112 HeapPage* pages_tail_; | 118 HeapPage* pages_tail_; |
| 113 HeapPage* large_pages_; | 119 HeapPage* large_pages_; |
| 114 | 120 |
| 115 // Various sizes being tracked for this generation. | 121 // Various sizes being tracked for this generation. |
| 116 intptr_t max_capacity_; | 122 intptr_t max_capacity_; |
| 117 intptr_t capacity_; | 123 intptr_t capacity_; |
| 118 intptr_t in_use_; | 124 intptr_t in_use_; |
| 119 | 125 |
| 120 // Old-gen GC cycle count. | 126 // Old-gen GC cycle count. |
| 121 int count_; | 127 int count_; |
| 122 | 128 |
| 123 bool is_executable_; | 129 bool is_executable_; |
| 124 | 130 |
| 125 // Keep track whether a MarkSweep is currently running. | 131 // Keep track whether a MarkSweep is currently running. |
| 126 bool sweeping_; | 132 bool sweeping_; |
| 127 | 133 |
| 128 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 134 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 129 }; | 135 }; |
| 130 | 136 |
| 131 } // namespace dart | 137 } // namespace dart |
| 132 | 138 |
| 133 #endif // VM_PAGES_H_ | 139 #endif // VM_PAGES_H_ |
| OLD | NEW |