Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/heap/spaces.h

Issue 2836583002: [heap] Allow concurrently transferring colors (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 663
664 static MarkingState Internal(MemoryChunk* chunk) { 664 static MarkingState Internal(MemoryChunk* chunk) {
665 return MarkingState( 665 return MarkingState(
666 Bitmap::FromAddress(chunk->address() + MemoryChunk::kHeaderSize), 666 Bitmap::FromAddress(chunk->address() + MemoryChunk::kHeaderSize),
667 &chunk->live_byte_count_); 667 &chunk->live_byte_count_);
668 } 668 }
669 669
670 MarkingState(Bitmap* bitmap, intptr_t* live_bytes) 670 MarkingState(Bitmap* bitmap, intptr_t* live_bytes)
671 : bitmap_(bitmap), live_bytes_(live_bytes) {} 671 : bitmap_(bitmap), live_bytes_(live_bytes) {}
672 672
673 void IncrementLiveBytes(intptr_t by) const { 673 template <MarkBit::AccessMode mode = MarkBit::NON_ATOMIC>
674 *live_bytes_ += static_cast<int>(by); 674 inline void IncrementLiveBytes(intptr_t by) const;
675 } 675
676 void SetLiveBytes(intptr_t value) const { 676 void SetLiveBytes(intptr_t value) const {
677 *live_bytes_ = static_cast<int>(value); 677 *live_bytes_ = static_cast<int>(value);
678 } 678 }
679 679
680 void ClearLiveness() const { 680 void ClearLiveness() const {
681 bitmap_->Clear(); 681 bitmap_->Clear();
682 *live_bytes_ = 0; 682 *live_bytes_ = 0;
683 } 683 }
684 684
685 Bitmap* bitmap() const { return bitmap_; } 685 Bitmap* bitmap() const { return bitmap_; }
686 intptr_t live_bytes() const { return *live_bytes_; } 686 intptr_t live_bytes() const { return *live_bytes_; }
687 687
688 private: 688 private:
689 Bitmap* bitmap_; 689 Bitmap* bitmap_;
690 intptr_t* live_bytes_; 690 intptr_t* live_bytes_;
691 }; 691 };
692 692
693 template <>
694 inline void MarkingState::IncrementLiveBytes<MarkBit::NON_ATOMIC>(
695 intptr_t by) const {
696 *live_bytes_ += by;
697 }
698
699 template <>
700 inline void MarkingState::IncrementLiveBytes<MarkBit::ATOMIC>(
701 intptr_t by) const {
702 reinterpret_cast<base::AtomicNumber<intptr_t>*>(live_bytes_)->Increment(by);
703 }
704
693 // ----------------------------------------------------------------------------- 705 // -----------------------------------------------------------------------------
694 // A page is a memory chunk of a size 1MB. Large object pages may be larger. 706 // A page is a memory chunk of a size 1MB. Large object pages may be larger.
695 // 707 //
696 // The only way to get a page pointer is by calling factory methods: 708 // The only way to get a page pointer is by calling factory methods:
697 // Page* p = Page::FromAddress(addr); or 709 // Page* p = Page::FromAddress(addr); or
698 // Page* p = Page::FromTopOrLimit(top); 710 // Page* p = Page::FromTopOrLimit(top);
699 class Page : public MemoryChunk { 711 class Page : public MemoryChunk {
700 public: 712 public:
701 static const intptr_t kCopyAllFlags = ~0; 713 static const intptr_t kCopyAllFlags = ~0;
702 714
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 PageIterator old_iterator_; 2963 PageIterator old_iterator_;
2952 PageIterator code_iterator_; 2964 PageIterator code_iterator_;
2953 PageIterator map_iterator_; 2965 PageIterator map_iterator_;
2954 LargePageIterator lo_iterator_; 2966 LargePageIterator lo_iterator_;
2955 }; 2967 };
2956 2968
2957 } // namespace internal 2969 } // namespace internal
2958 } // namespace v8 2970 } // namespace v8
2959 2971
2960 #endif // V8_HEAP_SPACES_H_ 2972 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698