| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpaceController); | 144 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpaceController); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 | 147 |
| 148 class PageSpace { | 148 class PageSpace { |
| 149 public: | 149 public: |
| 150 // TODO(iposva): Determine heap sizes and tune the page size accordingly. | 150 // TODO(iposva): Determine heap sizes and tune the page size accordingly. |
| 151 static const intptr_t kPageSize = 256 * KB; | 151 static const intptr_t kPageSize = 256 * KB; |
| 152 static const intptr_t kPageAlignment = kPageSize; | 152 static const intptr_t kPageAlignment = kPageSize; |
| 153 | 153 |
| 154 enum GrowthPolicy { |
| 155 kControlGrowth, |
| 156 kForceGrowth |
| 157 }; |
| 158 |
| 154 PageSpace(Heap* heap, intptr_t max_capacity, bool is_executable = false); | 159 PageSpace(Heap* heap, intptr_t max_capacity, bool is_executable = false); |
| 155 ~PageSpace(); | 160 ~PageSpace(); |
| 156 | 161 |
| 157 uword TryAllocate(intptr_t size); | 162 uword TryAllocate(intptr_t size); |
| 163 uword TryAllocate(intptr_t size, GrowthPolicy growth_policy); |
| 158 | 164 |
| 159 intptr_t in_use() const { return in_use_; } | 165 intptr_t in_use() const { return in_use_; } |
| 160 intptr_t capacity() const { return capacity_; } | 166 intptr_t capacity() const { return capacity_; } |
| 161 | 167 |
| 162 bool Contains(uword addr) const; | 168 bool Contains(uword addr) const; |
| 163 bool IsValidAddress(uword addr) const { | 169 bool IsValidAddress(uword addr) const { |
| 164 return Contains(addr); | 170 return Contains(addr); |
| 165 } | 171 } |
| 166 static bool IsPageAllocatableSize(intptr_t size) { | 172 static bool IsPageAllocatableSize(intptr_t size) { |
| 167 return size <= kAllocatablePageSize; | 173 return size <= kAllocatablePageSize; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 bool sweeping_; | 236 bool sweeping_; |
| 231 | 237 |
| 232 PageSpaceController page_space_controller_; | 238 PageSpaceController page_space_controller_; |
| 233 | 239 |
| 234 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 240 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 235 }; | 241 }; |
| 236 | 242 |
| 237 } // namespace dart | 243 } // namespace dart |
| 238 | 244 |
| 239 #endif // VM_PAGES_H_ | 245 #endif // VM_PAGES_H_ |
| OLD | NEW |