OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <unordered_set> | 10 #include <unordered_set> |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 // Checks whether |addr| can be a limit of addresses in this page. It's a | 406 // Checks whether |addr| can be a limit of addresses in this page. It's a |
407 // limit if it's in the page, or if it's just after the last byte of the page. | 407 // limit if it's in the page, or if it's just after the last byte of the page. |
408 bool ContainsLimit(Address addr) { | 408 bool ContainsLimit(Address addr) { |
409 return addr >= area_start() && addr <= area_end(); | 409 return addr >= area_start() && addr <= area_end(); |
410 } | 410 } |
411 | 411 |
412 base::AtomicValue<ConcurrentSweepingState>& concurrent_sweeping_state() { | 412 base::AtomicValue<ConcurrentSweepingState>& concurrent_sweeping_state() { |
413 return concurrent_sweeping_; | 413 return concurrent_sweeping_; |
414 } | 414 } |
415 | 415 |
| 416 bool SweepingDone() { |
| 417 return concurrent_sweeping_state().Value() == kSweepingDone; |
| 418 } |
| 419 |
416 // Manage live byte count, i.e., count of bytes in black objects. | 420 // Manage live byte count, i.e., count of bytes in black objects. |
417 inline void ResetLiveBytes(); | 421 inline void ResetLiveBytes(); |
418 inline void IncrementLiveBytes(int by); | 422 inline void IncrementLiveBytes(int by); |
419 | 423 |
420 int LiveBytes() { | 424 int LiveBytes() { |
421 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_); | 425 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_); |
422 return live_byte_count_; | 426 return live_byte_count_; |
423 } | 427 } |
424 | 428 |
425 void SetLiveBytes(int live_bytes) { | 429 void SetLiveBytes(int live_bytes) { |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 | 764 |
761 // WaitUntilSweepingCompleted only works when concurrent sweeping is in | 765 // WaitUntilSweepingCompleted only works when concurrent sweeping is in |
762 // progress. In particular, when we know that right before this call a | 766 // progress. In particular, when we know that right before this call a |
763 // sweeper thread was sweeping this page. | 767 // sweeper thread was sweeping this page. |
764 void WaitUntilSweepingCompleted() { | 768 void WaitUntilSweepingCompleted() { |
765 mutex_->Lock(); | 769 mutex_->Lock(); |
766 mutex_->Unlock(); | 770 mutex_->Unlock(); |
767 DCHECK(SweepingDone()); | 771 DCHECK(SweepingDone()); |
768 } | 772 } |
769 | 773 |
770 bool SweepingDone() { | |
771 return concurrent_sweeping_state().Value() == kSweepingDone; | |
772 } | |
773 | |
774 void ResetFreeListStatistics(); | 774 void ResetFreeListStatistics(); |
775 | 775 |
776 size_t AvailableInFreeList(); | 776 size_t AvailableInFreeList(); |
777 | 777 |
778 size_t LiveBytesFromFreeList() { | 778 size_t LiveBytesFromFreeList() { |
779 DCHECK_GE(area_size(), wasted_memory() + available_in_free_list()); | 779 DCHECK_GE(area_size(), wasted_memory() + available_in_free_list()); |
780 return area_size() - wasted_memory() - available_in_free_list(); | 780 return area_size() - wasted_memory() - available_in_free_list(); |
781 } | 781 } |
782 | 782 |
783 FreeListCategory* free_list_category(FreeListCategoryType type) { | 783 FreeListCategory* free_list_category(FreeListCategoryType type) { |
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2933 PageIterator old_iterator_; | 2933 PageIterator old_iterator_; |
2934 PageIterator code_iterator_; | 2934 PageIterator code_iterator_; |
2935 PageIterator map_iterator_; | 2935 PageIterator map_iterator_; |
2936 LargePageIterator lo_iterator_; | 2936 LargePageIterator lo_iterator_; |
2937 }; | 2937 }; |
2938 | 2938 |
2939 } // namespace internal | 2939 } // namespace internal |
2940 } // namespace v8 | 2940 } // namespace v8 |
2941 | 2941 |
2942 #endif // V8_HEAP_SPACES_H_ | 2942 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |