| 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/lockers.h" | 10 #include "vm/lockers.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 bool is_locked = false; | 211 bool is_locked = false; |
| 212 return TryAllocateInternal( | 212 return TryAllocateInternal( |
| 213 size, type, growth_policy, is_protected, is_locked); | 213 size, type, growth_policy, is_protected, is_locked); |
| 214 } | 214 } |
| 215 | 215 |
| 216 bool NeedsGarbageCollection() const { | 216 bool NeedsGarbageCollection() const { |
| 217 return page_space_controller_.NeedsGarbageCollection(usage_) || | 217 return page_space_controller_.NeedsGarbageCollection(usage_) || |
| 218 NeedsExternalGC(); | 218 NeedsExternalGC(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 intptr_t UsedInWords() const { return usage_.used_in_words; } | 221 int64_t UsedInWords() const { return usage_.used_in_words; } |
| 222 intptr_t CapacityInWords() const { | 222 int64_t CapacityInWords() const { |
| 223 MutexLocker ml(pages_lock_); | 223 MutexLocker ml(pages_lock_); |
| 224 return usage_.capacity_in_words; | 224 return usage_.capacity_in_words; |
| 225 } | 225 } |
| 226 void IncreaseCapacityInWords(intptr_t increase_in_words) { | 226 void IncreaseCapacityInWords(intptr_t increase_in_words) { |
| 227 MutexLocker ml(pages_lock_); | 227 MutexLocker ml(pages_lock_); |
| 228 IncreaseCapacityInWordsLocked(increase_in_words); | 228 IncreaseCapacityInWordsLocked(increase_in_words); |
| 229 } | 229 } |
| 230 void IncreaseCapacityInWordsLocked(intptr_t increase_in_words) { | 230 void IncreaseCapacityInWordsLocked(intptr_t increase_in_words) { |
| 231 DEBUG_ASSERT(pages_lock_->IsOwnedByCurrentThread()); | 231 DEBUG_ASSERT(pages_lock_->IsOwnedByCurrentThread()); |
| 232 usage_.capacity_in_words += increase_in_words; | 232 usage_.capacity_in_words += increase_in_words; |
| 233 UpdateMaxCapacityLocked(); | 233 UpdateMaxCapacityLocked(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void UpdateMaxCapacityLocked(); | 236 void UpdateMaxCapacityLocked(); |
| 237 void UpdateMaxUsed(); |
| 237 | 238 |
| 238 intptr_t ExternalInWords() const { | 239 int64_t ExternalInWords() const { |
| 239 return usage_.external_in_words; | 240 return usage_.external_in_words; |
| 240 } | 241 } |
| 241 SpaceUsage GetCurrentUsage() const { | 242 SpaceUsage GetCurrentUsage() const { |
| 242 MutexLocker ml(pages_lock_); | 243 MutexLocker ml(pages_lock_); |
| 243 return usage_; | 244 return usage_; |
| 244 } | 245 } |
| 245 | 246 |
| 246 bool Contains(uword addr) const; | 247 bool Contains(uword addr) const; |
| 247 bool Contains(uword addr, HeapPage::PageType type) const; | 248 bool Contains(uword addr, HeapPage::PageType type) const; |
| 248 bool IsValidAddress(uword addr) const { | 249 bool IsValidAddress(uword addr) const { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 friend class HeapIterationScope; | 448 friend class HeapIterationScope; |
| 448 friend class PageSpaceController; | 449 friend class PageSpaceController; |
| 449 friend class SweeperTask; | 450 friend class SweeperTask; |
| 450 | 451 |
| 451 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 452 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 452 }; | 453 }; |
| 453 | 454 |
| 454 } // namespace dart | 455 } // namespace dart |
| 455 | 456 |
| 456 #endif // VM_PAGES_H_ | 457 #endif // VM_PAGES_H_ |
| OLD | NEW |