| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 static HeapPage* PageFor(RawObject* raw_obj) { | 106 static HeapPage* PageFor(RawObject* raw_obj) { |
| 107 return reinterpret_cast<HeapPage*>( | 107 return reinterpret_cast<HeapPage*>( |
| 108 RawObject::ToAddr(raw_obj) & ~(kPageSize -1)); | 108 RawObject::ToAddr(raw_obj) & ~(kPageSize -1)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); | 112 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); |
| 113 | 113 |
| 114 void AllocatePage(); | 114 void AllocatePage(); |
| 115 void FreePage(HeapPage* page, HeapPage* previous_page); |
| 115 HeapPage* AllocateLargePage(intptr_t size); | 116 HeapPage* AllocateLargePage(intptr_t size); |
| 116 void FreeLargePage(HeapPage* page, HeapPage* previous_page); | 117 void FreeLargePage(HeapPage* page, HeapPage* previous_page); |
| 117 void FreePages(HeapPage* pages); | 118 void FreePages(HeapPage* pages); |
| 118 | 119 |
| 119 static intptr_t LargePageSizeFor(intptr_t size); | 120 static intptr_t LargePageSizeFor(intptr_t size); |
| 120 bool CanIncreaseCapacity(intptr_t increase) { | 121 bool CanIncreaseCapacity(intptr_t increase) { |
| 121 ASSERT(capacity_ <= max_capacity_); | 122 ASSERT(capacity_ <= max_capacity_); |
| 122 return increase <= (max_capacity_ - capacity_); | 123 return increase <= (max_capacity_ - capacity_); |
| 123 } | 124 } |
| 124 | 125 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 151 | 152 |
| 152 // Keep track whether a MarkSweep is currently running. | 153 // Keep track whether a MarkSweep is currently running. |
| 153 bool sweeping_; | 154 bool sweeping_; |
| 154 | 155 |
| 155 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 156 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 156 }; | 157 }; |
| 157 | 158 |
| 158 } // namespace dart | 159 } // namespace dart |
| 159 | 160 |
| 160 #endif // VM_PAGES_H_ | 161 #endif // VM_PAGES_H_ |
| OLD | NEW |