| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 // Checks whether |addr| can be a limit of addresses in this page. It's a | 404 // Checks whether |addr| can be a limit of addresses in this page. It's a |
| 405 // limit if it's in the page, or if it's just after the last byte of the page. | 405 // limit if it's in the page, or if it's just after the last byte of the page. |
| 406 bool ContainsLimit(Address addr) { | 406 bool ContainsLimit(Address addr) { |
| 407 return addr >= area_start() && addr <= area_end(); | 407 return addr >= area_start() && addr <= area_end(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 base::AtomicValue<ConcurrentSweepingState>& concurrent_sweeping_state() { | 410 base::AtomicValue<ConcurrentSweepingState>& concurrent_sweeping_state() { |
| 411 return concurrent_sweeping_; | 411 return concurrent_sweeping_; |
| 412 } | 412 } |
| 413 | 413 |
| 414 bool SweepingDone() { |
| 415 return concurrent_sweeping_state().Value() == kSweepingDone; |
| 416 } |
| 417 |
| 414 // Manage live byte count, i.e., count of bytes in black objects. | 418 // Manage live byte count, i.e., count of bytes in black objects. |
| 415 inline void ResetLiveBytes(); | 419 inline void ResetLiveBytes(); |
| 416 inline void IncrementLiveBytes(int by); | 420 inline void IncrementLiveBytes(int by); |
| 417 | 421 |
| 418 int LiveBytes() { | 422 int LiveBytes() { |
| 419 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_); | 423 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_); |
| 420 return live_byte_count_; | 424 return live_byte_count_; |
| 421 } | 425 } |
| 422 | 426 |
| 423 void SetLiveBytes(int live_bytes) { | 427 void SetLiveBytes(int live_bytes) { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 732 |
| 729 // WaitUntilSweepingCompleted only works when concurrent sweeping is in | 733 // WaitUntilSweepingCompleted only works when concurrent sweeping is in |
| 730 // progress. In particular, when we know that right before this call a | 734 // progress. In particular, when we know that right before this call a |
| 731 // sweeper thread was sweeping this page. | 735 // sweeper thread was sweeping this page. |
| 732 void WaitUntilSweepingCompleted() { | 736 void WaitUntilSweepingCompleted() { |
| 733 mutex_->Lock(); | 737 mutex_->Lock(); |
| 734 mutex_->Unlock(); | 738 mutex_->Unlock(); |
| 735 DCHECK(SweepingDone()); | 739 DCHECK(SweepingDone()); |
| 736 } | 740 } |
| 737 | 741 |
| 738 bool SweepingDone() { | |
| 739 return concurrent_sweeping_state().Value() == kSweepingDone; | |
| 740 } | |
| 741 | |
| 742 void ResetFreeListStatistics(); | 742 void ResetFreeListStatistics(); |
| 743 | 743 |
| 744 size_t AvailableInFreeList(); | 744 size_t AvailableInFreeList(); |
| 745 | 745 |
| 746 size_t LiveBytesFromFreeList() { | 746 size_t LiveBytesFromFreeList() { |
| 747 DCHECK_GE(area_size(), wasted_memory() + available_in_free_list()); | 747 DCHECK_GE(area_size(), wasted_memory() + available_in_free_list()); |
| 748 return area_size() - wasted_memory() - available_in_free_list(); | 748 return area_size() - wasted_memory() - available_in_free_list(); |
| 749 } | 749 } |
| 750 | 750 |
| 751 FreeListCategory* free_list_category(FreeListCategoryType type) { | 751 FreeListCategory* free_list_category(FreeListCategoryType type) { |
| (...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2901 PageIterator old_iterator_; | 2901 PageIterator old_iterator_; |
| 2902 PageIterator code_iterator_; | 2902 PageIterator code_iterator_; |
| 2903 PageIterator map_iterator_; | 2903 PageIterator map_iterator_; |
| 2904 LargePageIterator lo_iterator_; | 2904 LargePageIterator lo_iterator_; |
| 2905 }; | 2905 }; |
| 2906 | 2906 |
| 2907 } // namespace internal | 2907 } // namespace internal |
| 2908 } // namespace v8 | 2908 } // namespace v8 |
| 2909 | 2909 |
| 2910 #endif // V8_HEAP_SPACES_H_ | 2910 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |