| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
| 6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
| 7 | 7 |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
| 10 | 10 |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 DCHECK(cell_index_ == Bitmap::IndexToCell(Bitmap::CellAlignIndex( | 822 DCHECK(cell_index_ == Bitmap::IndexToCell(Bitmap::CellAlignIndex( |
| 823 chunk_->AddressToMarkbitIndex(cell_base_)))); | 823 chunk_->AddressToMarkbitIndex(cell_base_)))); |
| 824 return cell_base_; | 824 return cell_base_; |
| 825 } | 825 } |
| 826 | 826 |
| 827 inline void Advance() { | 827 inline void Advance() { |
| 828 cell_index_++; | 828 cell_index_++; |
| 829 cell_base_ += 32 * kPointerSize; | 829 cell_base_ += 32 * kPointerSize; |
| 830 } | 830 } |
| 831 | 831 |
| 832 // Return the next mark bit cell. If there is no next it returns 0; |
| 833 inline MarkBit::CellType PeekNext() { |
| 834 if (HasNext()) { |
| 835 return cells_[cell_index_ + 1]; |
| 836 } |
| 837 return 0; |
| 838 } |
| 839 |
| 832 private: | 840 private: |
| 833 MemoryChunk* chunk_; | 841 MemoryChunk* chunk_; |
| 834 MarkBit::CellType* cells_; | 842 MarkBit::CellType* cells_; |
| 835 unsigned int last_cell_index_; | 843 unsigned int last_cell_index_; |
| 836 unsigned int cell_index_; | 844 unsigned int cell_index_; |
| 837 Address cell_base_; | 845 Address cell_base_; |
| 838 }; | 846 }; |
| 839 | 847 |
| 840 | 848 |
| 841 class EvacuationScope BASE_EMBEDDED { | 849 class EvacuationScope BASE_EMBEDDED { |
| 842 public: | 850 public: |
| 843 explicit EvacuationScope(MarkCompactCollector* collector) | 851 explicit EvacuationScope(MarkCompactCollector* collector) |
| 844 : collector_(collector) { | 852 : collector_(collector) { |
| 845 collector_->set_evacuation(true); | 853 collector_->set_evacuation(true); |
| 846 } | 854 } |
| 847 | 855 |
| 848 ~EvacuationScope() { collector_->set_evacuation(false); } | 856 ~EvacuationScope() { collector_->set_evacuation(false); } |
| 849 | 857 |
| 850 private: | 858 private: |
| 851 MarkCompactCollector* collector_; | 859 MarkCompactCollector* collector_; |
| 852 }; | 860 }; |
| 853 | 861 |
| 854 | 862 |
| 855 const char* AllocationSpaceName(AllocationSpace space); | 863 const char* AllocationSpaceName(AllocationSpace space); |
| 856 } // namespace internal | 864 } // namespace internal |
| 857 } // namespace v8 | 865 } // namespace v8 |
| 858 | 866 |
| 859 #endif // V8_HEAP_MARK_COMPACT_H_ | 867 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |