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

Side by Side Diff: src/heap/sequential-marking-deque.h

Issue 2850373003: [heap] Fix computation of marking progress in incremental finalization. (Closed)
Patch Set: rearrange summands Created 3 years, 7 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/incremental-marking.cc ('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 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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_SEQUENTIAL_MARKING_DEQUE_ 5 #ifndef V8_HEAP_SEQUENTIAL_MARKING_DEQUE_
6 #define V8_HEAP_SEQUENTIAL_MARKING_DEQUE_ 6 #define V8_HEAP_SEQUENTIAL_MARKING_DEQUE_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "src/base/platform/mutex.h" 10 #include "src/base/platform/mutex.h"
(...skipping 29 matching lines...) Expand all
40 // Ensures that the marking deque is committed and will stay committed until 40 // Ensures that the marking deque is committed and will stay committed until
41 // StopUsing() is called. 41 // StopUsing() is called.
42 void StartUsing(); 42 void StartUsing();
43 void StopUsing(); 43 void StopUsing();
44 void Clear(); 44 void Clear();
45 45
46 inline bool IsFull() { return ((top_ + 1) & mask_) == bottom_; } 46 inline bool IsFull() { return ((top_ + 1) & mask_) == bottom_; }
47 47
48 inline bool IsEmpty() { return top_ == bottom_; } 48 inline bool IsEmpty() { return top_ == bottom_; }
49 49
50 int Size() {
51 // Return (top - bottom + capacity) % capacity, where capacity = mask + 1.
52 return (top_ - bottom_ + mask_ + 1) & mask_;
53 }
54
50 bool overflowed() const { return overflowed_; } 55 bool overflowed() const { return overflowed_; }
51 56
52 void ClearOverflowed() { overflowed_ = false; } 57 void ClearOverflowed() { overflowed_ = false; }
53 58
54 void SetOverflowed() { overflowed_ = true; } 59 void SetOverflowed() { overflowed_ = true; }
55 60
56 // Push the object on the marking stack if there is room, otherwise mark the 61 // Push the object on the marking stack if there is room, otherwise mark the
57 // deque as overflowed and wait for a rescan of the heap. 62 // deque as overflowed and wait for a rescan of the heap.
58 INLINE(bool Push(HeapObject* object)) { 63 INLINE(bool Push(HeapObject* object)) {
59 if (IsFull()) { 64 if (IsFull()) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 HeapObject* object = callback(array_[i]); 112 HeapObject* object = callback(array_[i]);
108 if (object) { 113 if (object) {
109 array_[new_top] = object; 114 array_[new_top] = object;
110 new_top = (new_top + 1) & mask_; 115 new_top = (new_top + 1) & mask_;
111 } 116 }
112 i = (i + 1) & mask_; 117 i = (i + 1) & mask_;
113 } 118 }
114 top_ = new_top; 119 top_ = new_top;
115 } 120 }
116 121
117 int top() { return top_; }
118
119 private: 122 private:
120 // This task uncommits the marking_deque backing store if 123 // This task uncommits the marking_deque backing store if
121 // markin_deque->in_use_ is false. 124 // markin_deque->in_use_ is false.
122 class UncommitTask : public CancelableTask { 125 class UncommitTask : public CancelableTask {
123 public: 126 public:
124 explicit UncommitTask(Isolate* isolate, 127 explicit UncommitTask(Isolate* isolate,
125 SequentialMarkingDeque* marking_deque) 128 SequentialMarkingDeque* marking_deque)
126 : CancelableTask(isolate), marking_deque_(marking_deque) {} 129 : CancelableTask(isolate), marking_deque_(marking_deque) {}
127 130
128 private: 131 private:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 bool uncommit_task_pending_; 172 bool uncommit_task_pending_;
170 Heap* heap_; 173 Heap* heap_;
171 174
172 DISALLOW_COPY_AND_ASSIGN(SequentialMarkingDeque); 175 DISALLOW_COPY_AND_ASSIGN(SequentialMarkingDeque);
173 }; 176 };
174 177
175 } // namespace internal 178 } // namespace internal
176 } // namespace v8 179 } // namespace v8
177 180
178 #endif // V8_SEQUENTIAL_MARKING_DEQUE_ 181 #endif // V8_SEQUENTIAL_MARKING_DEQUE_
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698