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

Side by Side Diff: src/heap/incremental-marking.h

Issue 2860323003: [heap] Reland "Make non-atomic markbit operations consistent with atomic ones." (Closed)
Patch Set: fix 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/heap.cc ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_INCREMENTAL_MARKING_H_ 5 #ifndef V8_HEAP_INCREMENTAL_MARKING_H_
6 #define V8_HEAP_INCREMENTAL_MARKING_H_ 6 #define V8_HEAP_INCREMENTAL_MARKING_H_
7 7
8 #include "src/cancelable-task.h" 8 #include "src/cancelable-task.h"
9 #include "src/execution.h" 9 #include "src/execution.h"
10 #include "src/heap/heap.h" 10 #include "src/heap/heap.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 explicit IncrementalMarking(Heap* heap); 58 explicit IncrementalMarking(Heap* heap);
59 59
60 MarkingState marking_state(HeapObject* object) const { 60 MarkingState marking_state(HeapObject* object) const {
61 return MarkingState::Internal(object); 61 return MarkingState::Internal(object);
62 } 62 }
63 63
64 MarkingState marking_state(MemoryChunk* chunk) const { 64 MarkingState marking_state(MemoryChunk* chunk) const {
65 return MarkingState::Internal(chunk); 65 return MarkingState::Internal(chunk);
66 } 66 }
67 67
68 void MarkBlack(HeapObject* object, int size);
69 void MarkGrey(HeapObject* object);
70
71 // Transfers mark bits without requiring proper object headers. 68 // Transfers mark bits without requiring proper object headers.
72 void TransferMark(Heap* heap, HeapObject* from, HeapObject* to); 69 void TransferMark(Heap* heap, HeapObject* from, HeapObject* to);
73 70
74 // Transfers color including live byte count, requiring properly set up 71 // Transfers color including live byte count, requiring properly set up
75 // objects. 72 // objects.
76 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> 73 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC>
77 V8_INLINE void TransferColor(HeapObject* from, HeapObject* to) { 74 V8_INLINE void TransferColor(HeapObject* from, HeapObject* to) {
78 if (ObjectMarking::IsBlack<access_mode>(to, marking_state(to))) { 75 if (ObjectMarking::IsBlack<access_mode>(to, marking_state(to))) {
79 DCHECK(black_allocation()); 76 DCHECK(black_allocation());
80 return; 77 return;
81 } 78 }
82 79
83 DCHECK(ObjectMarking::IsWhite<access_mode>(to, marking_state(to))); 80 DCHECK(ObjectMarking::IsWhite<access_mode>(to, marking_state(to)));
84 if (ObjectMarking::IsGrey<access_mode>(from, marking_state(from))) { 81 if (ObjectMarking::IsGrey<access_mode>(from, marking_state(from))) {
85 ObjectMarking::WhiteToGrey<access_mode>(to, marking_state(to)); 82 bool success =
83 ObjectMarking::WhiteToGrey<access_mode>(to, marking_state(to));
84 DCHECK(success);
85 USE(success);
86 } else if (ObjectMarking::IsBlack<access_mode>(from, marking_state(from))) { 86 } else if (ObjectMarking::IsBlack<access_mode>(from, marking_state(from))) {
87 ObjectMarking::WhiteToBlack<access_mode>(to, marking_state(to)); 87 bool success =
88 ObjectMarking::WhiteToBlack<access_mode>(to, marking_state(to));
89 DCHECK(success);
90 USE(success);
88 } 91 }
89 } 92 }
90 93
91 94
92 State state() { 95 State state() {
93 DCHECK(state_ == STOPPED || FLAG_incremental_marking); 96 DCHECK(state_ == STOPPED || FLAG_incremental_marking);
94 return state_; 97 return state_;
95 } 98 }
96 99
97 bool should_hurry() { return should_hurry_; } 100 bool should_hurry() { return should_hurry_; }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 INLINE(void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value)); 206 INLINE(void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value));
204 INLINE(void RecordWriteOfCodeEntry(JSFunction* host, Object** slot, 207 INLINE(void RecordWriteOfCodeEntry(JSFunction* host, Object** slot,
205 Code* value)); 208 Code* value));
206 209
207 void RecordWriteSlow(HeapObject* obj, Object** slot, Object* value); 210 void RecordWriteSlow(HeapObject* obj, Object** slot, Object* value);
208 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* value); 211 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* value);
209 void RecordWriteOfCodeEntrySlow(JSFunction* host, Object** slot, Code* value); 212 void RecordWriteOfCodeEntrySlow(JSFunction* host, Object** slot, Code* value);
210 void RecordCodeTargetPatch(Code* host, Address pc, HeapObject* value); 213 void RecordCodeTargetPatch(Code* host, Address pc, HeapObject* value);
211 void RecordCodeTargetPatch(Address pc, HeapObject* value); 214 void RecordCodeTargetPatch(Address pc, HeapObject* value);
212 215
213 void WhiteToGreyAndPush(HeapObject* obj); 216 // Returns true if the function succeeds in transitioning the object
217 // from white to grey.
218 bool WhiteToGreyAndPush(HeapObject* obj);
214 219
215 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { 220 inline void SetOldSpacePageFlags(MemoryChunk* chunk) {
216 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting()); 221 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting());
217 } 222 }
218 223
219 inline void SetNewSpacePageFlags(Page* chunk) { 224 inline void SetNewSpacePageFlags(Page* chunk) {
220 SetNewSpacePageFlags(chunk, IsMarking()); 225 SetNewSpacePageFlags(chunk, IsMarking());
221 } 226 }
222 227
223 bool IsCompacting() { return IsMarking() && is_compacting_; } 228 bool IsCompacting() { return IsMarking() && is_compacting_; }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 342
338 Observer new_generation_observer_; 343 Observer new_generation_observer_;
339 Observer old_generation_observer_; 344 Observer old_generation_observer_;
340 345
341 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); 346 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking);
342 }; 347 };
343 } // namespace internal 348 } // namespace internal
344 } // namespace v8 349 } // namespace v8
345 350
346 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ 351 #endif // V8_HEAP_INCREMENTAL_MARKING_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698