| 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/spaces.h" | 10 #include "vm/spaces.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 PageSpace(Heap* heap, intptr_t max_capacity_in_words); | 194 PageSpace(Heap* heap, intptr_t max_capacity_in_words); |
| 195 ~PageSpace(); | 195 ~PageSpace(); |
| 196 | 196 |
| 197 uword TryAllocate(intptr_t size, | 197 uword TryAllocate(intptr_t size, |
| 198 HeapPage::PageType type = HeapPage::kData, | 198 HeapPage::PageType type = HeapPage::kData, |
| 199 GrowthPolicy growth_policy = kControlGrowth); | 199 GrowthPolicy growth_policy = kControlGrowth); |
| 200 | 200 |
| 201 bool NeedsGarbageCollection() const { | 201 bool NeedsGarbageCollection() const { |
| 202 return page_space_controller_.NeedsGarbageCollection(usage_); | 202 return page_space_controller_.NeedsGarbageCollection(usage_) || |
| 203 NeedsExternalGC(); |
| 203 } | 204 } |
| 204 | 205 |
| 205 intptr_t UsedInWords() const { return usage_.used_in_words; } | 206 intptr_t UsedInWords() const { return usage_.used_in_words; } |
| 206 intptr_t CapacityInWords() const { return usage_.capacity_in_words; } | 207 intptr_t CapacityInWords() const { return usage_.capacity_in_words; } |
| 207 intptr_t ExternalInWords() const { | 208 intptr_t ExternalInWords() const { |
| 208 return usage_.external_in_words; | 209 return usage_.external_in_words; |
| 209 } | 210 } |
| 210 SpaceUsage GetCurrentUsage() const { return usage_; } | 211 SpaceUsage GetCurrentUsage() const { return usage_; } |
| 211 | 212 |
| 212 bool Contains(uword addr) const; | 213 bool Contains(uword addr) const; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 235 page_space_controller_.Enable(usage_); | 236 page_space_controller_.Enable(usage_); |
| 236 } else { | 237 } else { |
| 237 page_space_controller_.Disable(); | 238 page_space_controller_.Disable(); |
| 238 } | 239 } |
| 239 } | 240 } |
| 240 | 241 |
| 241 bool GrowthControlState() { | 242 bool GrowthControlState() { |
| 242 return page_space_controller_.is_enabled(); | 243 return page_space_controller_.is_enabled(); |
| 243 } | 244 } |
| 244 | 245 |
| 245 bool NeedExternalGC() { | 246 bool NeedsExternalGC() const { |
| 246 return UsedInWords() + ExternalInWords() > max_capacity_in_words_; | 247 return UsedInWords() + ExternalInWords() > max_capacity_in_words_; |
| 247 } | 248 } |
| 248 | 249 |
| 249 void WriteProtect(bool read_only); | 250 void WriteProtect(bool read_only); |
| 250 | 251 |
| 251 void AddGCTime(int64_t micros) { | 252 void AddGCTime(int64_t micros) { |
| 252 gc_time_micros_ += micros; | 253 gc_time_micros_ += micros; |
| 253 } | 254 } |
| 254 | 255 |
| 255 int64_t gc_time_micros() const { | 256 int64_t gc_time_micros() const { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 intptr_t collections_; | 322 intptr_t collections_; |
| 322 | 323 |
| 323 friend class PageSpaceController; | 324 friend class PageSpaceController; |
| 324 | 325 |
| 325 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 326 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 326 }; | 327 }; |
| 327 | 328 |
| 328 } // namespace dart | 329 } // namespace dart |
| 329 | 330 |
| 330 #endif // VM_PAGES_H_ | 331 #endif // VM_PAGES_H_ |
| OLD | NEW |