| 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/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/virtual_memory.h" | 9 #include "vm/virtual_memory.h" |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 bool Contains(uword addr) const; | 78 bool Contains(uword addr) const; |
| 79 bool IsValidAddress(uword addr) const { | 79 bool IsValidAddress(uword addr) const { |
| 80 return Contains(addr); | 80 return Contains(addr); |
| 81 } | 81 } |
| 82 static intptr_t IsPageAllocatableSize(intptr_t size) { | 82 static intptr_t IsPageAllocatableSize(intptr_t size) { |
| 83 return size <= kAllocatablePageSize; | 83 return size <= kAllocatablePageSize; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 86 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
| 87 | 87 |
| 88 // Collect the garbage in the page space using mark-sweep. |
| 89 void MarkSweep(); |
| 90 |
| 88 private: | 91 private: |
| 89 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); | 92 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); |
| 90 | 93 |
| 91 void AllocatePage(); | 94 void AllocatePage(); |
| 92 HeapPage* AllocateLargePage(intptr_t size); | 95 HeapPage* AllocateLargePage(intptr_t size); |
| 93 void FreePages(HeapPage* pages); | 96 void FreePages(HeapPage* pages); |
| 94 | 97 |
| 95 uword TryBumpAllocate(intptr_t size); | 98 uword TryBumpAllocate(intptr_t size); |
| 96 | 99 |
| 97 Heap* heap_; | 100 Heap* heap_; |
| 98 | 101 |
| 99 HeapPage* pages_; | 102 HeapPage* pages_; |
| 100 HeapPage* pages_tail_; | 103 HeapPage* pages_tail_; |
| 101 HeapPage* large_pages_; | 104 HeapPage* large_pages_; |
| 102 | 105 |
| 103 // Various sizes being tracked for this generation. | 106 // Various sizes being tracked for this generation. |
| 104 intptr_t max_capacity_; | 107 intptr_t max_capacity_; |
| 105 intptr_t capacity_; | 108 intptr_t capacity_; |
| 106 intptr_t in_use_; | 109 intptr_t in_use_; |
| 107 | 110 |
| 111 // Old-gen GC cycle count. |
| 112 int count_; |
| 113 |
| 108 bool is_executable_; | 114 bool is_executable_; |
| 109 | 115 |
| 116 // Keep track whether a MarkSweep is currently running. |
| 117 bool sweeping_; |
| 118 |
| 110 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 119 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 111 }; | 120 }; |
| 112 | 121 |
| 113 } // namespace dart | 122 } // namespace dart |
| 114 | 123 |
| 115 #endif // VM_PAGES_H_ | 124 #endif // VM_PAGES_H_ |
| OLD | NEW |