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

Side by Side Diff: src/heap/mark-compact.h

Issue 1420423009: [heap] Black allocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
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 #include "src/heap/store-buffer.h" 10 #include "src/heap/store-buffer.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (IsBlack(mark_bit)) return BLACK_OBJECT; 153 if (IsBlack(mark_bit)) return BLACK_OBJECT;
154 if (IsWhite(mark_bit)) return WHITE_OBJECT; 154 if (IsWhite(mark_bit)) return WHITE_OBJECT;
155 if (IsGrey(mark_bit)) return GREY_OBJECT; 155 if (IsGrey(mark_bit)) return GREY_OBJECT;
156 UNREACHABLE(); 156 UNREACHABLE();
157 return IMPOSSIBLE_COLOR; 157 return IMPOSSIBLE_COLOR;
158 } 158 }
159 #endif 159 #endif
160 160
161 // Returns true if the transferred color is black. 161 // Returns true if the transferred color is black.
162 INLINE(static bool TransferColor(HeapObject* from, HeapObject* to)) { 162 INLINE(static bool TransferColor(HeapObject* from, HeapObject* to)) {
163 if (Page::FromAddress(to->address())->IsFlagSet(Page::BLACK_PAGE))
164 return true;
163 MarkBit from_mark_bit = MarkBitFrom(from); 165 MarkBit from_mark_bit = MarkBitFrom(from);
164 MarkBit to_mark_bit = MarkBitFrom(to); 166 MarkBit to_mark_bit = MarkBitFrom(to);
165 DCHECK(Marking::IsWhite(to_mark_bit)); 167 DCHECK(Marking::IsWhite(to_mark_bit));
166 if (from_mark_bit.Get()) { 168 if (from_mark_bit.Get()) {
167 to_mark_bit.Set(); 169 to_mark_bit.Set();
168 if (from_mark_bit.Next().Get()) { 170 if (from_mark_bit.Next().Get()) {
169 to_mark_bit.Next().Set(); 171 to_mark_bit.Next().Set();
170 return true; 172 return true;
171 } 173 }
172 } 174 }
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 801
800 // True if parallel compaction is currently in progress. 802 // True if parallel compaction is currently in progress.
801 bool compaction_in_progress_; 803 bool compaction_in_progress_;
802 804
803 // Semaphore used to synchronize sweeper tasks. 805 // Semaphore used to synchronize sweeper tasks.
804 base::Semaphore pending_sweeper_tasks_semaphore_; 806 base::Semaphore pending_sweeper_tasks_semaphore_;
805 807
806 // Semaphore used to synchronize compaction tasks. 808 // Semaphore used to synchronize compaction tasks.
807 base::Semaphore pending_compaction_tasks_semaphore_; 809 base::Semaphore pending_compaction_tasks_semaphore_;
808 810
811 bool black_allocation_;
812
809 friend class Heap; 813 friend class Heap;
810 friend class StoreBuffer; 814 friend class StoreBuffer;
811 }; 815 };
812 816
813 817
814 class MarkBitCellIterator BASE_EMBEDDED { 818 class MarkBitCellIterator BASE_EMBEDDED {
815 public: 819 public:
816 explicit MarkBitCellIterator(MemoryChunk* chunk) : chunk_(chunk) { 820 explicit MarkBitCellIterator(MemoryChunk* chunk) : chunk_(chunk) {
817 last_cell_index_ = Bitmap::IndexToCell(Bitmap::CellAlignIndex( 821 last_cell_index_ = Bitmap::IndexToCell(Bitmap::CellAlignIndex(
818 chunk_->AddressToMarkbitIndex(chunk_->area_end()))); 822 chunk_->AddressToMarkbitIndex(chunk_->area_end())));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 private: 896 private:
893 MarkCompactCollector* collector_; 897 MarkCompactCollector* collector_;
894 }; 898 };
895 899
896 900
897 const char* AllocationSpaceName(AllocationSpace space); 901 const char* AllocationSpaceName(AllocationSpace space);
898 } // namespace internal 902 } // namespace internal
899 } // namespace v8 903 } // namespace v8
900 904
901 #endif // V8_HEAP_MARK_COMPACT_H_ 905 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698