| 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 RUNTIME_VM_PAGES_H_ | 5 #ifndef RUNTIME_VM_PAGES_H_ |
| 6 #define RUNTIME_VM_PAGES_H_ | 6 #define RUNTIME_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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 uword TryAllocatePromoLocked(intptr_t size, GrowthPolicy growth_policy); | 313 uword TryAllocatePromoLocked(intptr_t size, GrowthPolicy growth_policy); |
| 314 | 314 |
| 315 // Bump block allocation from generated code. | 315 // Bump block allocation from generated code. |
| 316 uword* TopAddress() { return &bump_top_; } | 316 uword* TopAddress() { return &bump_top_; } |
| 317 uword* EndAddress() { return &bump_end_; } | 317 uword* EndAddress() { return &bump_end_; } |
| 318 static intptr_t top_offset() { return OFFSET_OF(PageSpace, bump_top_); } | 318 static intptr_t top_offset() { return OFFSET_OF(PageSpace, bump_top_); } |
| 319 static intptr_t end_offset() { return OFFSET_OF(PageSpace, bump_end_); } | 319 static intptr_t end_offset() { return OFFSET_OF(PageSpace, bump_end_); } |
| 320 | 320 |
| 321 void SetupImagePage(void* pointer, uword size, bool is_executable); | 321 void SetupImagePage(void* pointer, uword size, bool is_executable); |
| 322 | 322 |
| 323 // Return any bump allocation block to the freelist. |
| 324 void AbandonBumpAllocation(); |
| 325 |
| 323 private: | 326 private: |
| 324 // Ids for time and data records in Heap::GCStats. | 327 // Ids for time and data records in Heap::GCStats. |
| 325 enum { | 328 enum { |
| 326 // Time | 329 // Time |
| 327 kConcurrentSweep = 0, | 330 kConcurrentSweep = 0, |
| 328 kSafePoint = 1, | 331 kSafePoint = 1, |
| 329 kMarkObjects = 2, | 332 kMarkObjects = 2, |
| 330 kResetFreeLists = 3, | 333 kResetFreeLists = 3, |
| 331 kSweepPages = 4, | 334 kSweepPages = 4, |
| 332 kSweepLargePages = 5, | 335 kSweepLargePages = 5, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 346 bool is_locked); | 349 bool is_locked); |
| 347 uword TryAllocateInFreshPage(intptr_t size, | 350 uword TryAllocateInFreshPage(intptr_t size, |
| 348 HeapPage::PageType type, | 351 HeapPage::PageType type, |
| 349 GrowthPolicy growth_policy, | 352 GrowthPolicy growth_policy, |
| 350 bool is_locked); | 353 bool is_locked); |
| 351 uword TryAllocateDataBumpInternal(intptr_t size, | 354 uword TryAllocateDataBumpInternal(intptr_t size, |
| 352 GrowthPolicy growth_policy, | 355 GrowthPolicy growth_policy, |
| 353 bool is_locked); | 356 bool is_locked); |
| 354 // Makes bump block walkable; do not call concurrently with mutator. | 357 // Makes bump block walkable; do not call concurrently with mutator. |
| 355 void MakeIterable() const; | 358 void MakeIterable() const; |
| 356 // Return any bump allocation block to the freelist. | |
| 357 void AbandonBumpAllocation(); | |
| 358 HeapPage* AllocatePage(HeapPage::PageType type); | 359 HeapPage* AllocatePage(HeapPage::PageType type); |
| 359 void FreePage(HeapPage* page, HeapPage* previous_page); | 360 void FreePage(HeapPage* page, HeapPage* previous_page); |
| 360 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type); | 361 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type); |
| 361 void TruncateLargePage(HeapPage* page, intptr_t new_object_size_in_bytes); | 362 void TruncateLargePage(HeapPage* page, intptr_t new_object_size_in_bytes); |
| 362 void FreeLargePage(HeapPage* page, HeapPage* previous_page); | 363 void FreeLargePage(HeapPage* page, HeapPage* previous_page); |
| 363 void FreePages(HeapPage* pages); | 364 void FreePages(HeapPage* pages); |
| 364 HeapPage* NextPageAnySize(HeapPage* page) const { | 365 HeapPage* NextPageAnySize(HeapPage* page) const { |
| 365 ASSERT((pages_tail_ == NULL) || (pages_tail_->next() == NULL)); | 366 ASSERT((pages_tail_ == NULL) || (pages_tail_->next() == NULL)); |
| 366 ASSERT((exec_pages_tail_ == NULL) || (exec_pages_tail_->next() == NULL)); | 367 ASSERT((exec_pages_tail_ == NULL) || (exec_pages_tail_->next() == NULL)); |
| 367 if (page == pages_tail_) { | 368 if (page == pages_tail_) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 friend class HeapIterationScope; | 428 friend class HeapIterationScope; |
| 428 friend class PageSpaceController; | 429 friend class PageSpaceController; |
| 429 friend class SweeperTask; | 430 friend class SweeperTask; |
| 430 | 431 |
| 431 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 432 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 432 }; | 433 }; |
| 433 | 434 |
| 434 } // namespace dart | 435 } // namespace dart |
| 435 | 436 |
| 436 #endif // RUNTIME_VM_PAGES_H_ | 437 #endif // RUNTIME_VM_PAGES_H_ |
| OLD | NEW |