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_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 26 matching lines...) Expand all Loading... | |
37 explicit IncrementalMarking(Heap* heap); | 37 explicit IncrementalMarking(Heap* heap); |
38 | 38 |
39 MarkingState marking_state(HeapObject* object) const { | 39 MarkingState marking_state(HeapObject* object) const { |
40 return MarkingState::Internal(object); | 40 return MarkingState::Internal(object); |
41 } | 41 } |
42 | 42 |
43 MarkingState marking_state(MemoryChunk* chunk) const { | 43 MarkingState marking_state(MemoryChunk* chunk) const { |
44 return MarkingState::Internal(chunk); | 44 return MarkingState::Internal(chunk); |
45 } | 45 } |
46 | 46 |
47 void MarkBlack(HeapObject* object, int size); | |
48 void MarkGrey(HeapObject* object); | |
49 | |
50 // Transfers mark bits without requiring proper object headers. | 47 // Transfers mark bits without requiring proper object headers. |
51 void TransferMark(Heap* heap, HeapObject* from, HeapObject* to); | 48 void TransferMark(Heap* heap, HeapObject* from, HeapObject* to); |
52 | 49 |
53 // Transfers color including live byte count, requiring properly set up | 50 // Transfers color including live byte count, requiring properly set up |
54 // objects. | 51 // objects. |
55 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> | 52 template <MarkBit::AccessMode access_mode = MarkBit::NON_ATOMIC> |
56 V8_INLINE void TransferColor(HeapObject* from, HeapObject* to) { | 53 V8_INLINE void TransferColor(HeapObject* from, HeapObject* to) { |
57 if (ObjectMarking::IsBlack<access_mode>(to, marking_state(to))) { | 54 if (ObjectMarking::IsBlack<access_mode>(to, marking_state(to))) { |
58 DCHECK(black_allocation()); | 55 DCHECK(black_allocation()); |
59 return; | 56 return; |
60 } | 57 } |
61 | 58 |
62 DCHECK(ObjectMarking::IsWhite<access_mode>(to, marking_state(to))); | 59 DCHECK(ObjectMarking::IsWhite<access_mode>(to, marking_state(to))); |
63 if (ObjectMarking::IsGrey<access_mode>(from, marking_state(from))) { | 60 if (ObjectMarking::IsGrey<access_mode>(from, marking_state(from))) { |
64 ObjectMarking::WhiteToGrey<access_mode>(to, marking_state(to)); | 61 bool success = |
62 ObjectMarking::WhiteToGrey<access_mode>(to, marking_state(to)); | |
63 DCHECK(success); | |
64 USE(success); | |
65 } else if (ObjectMarking::IsBlack<access_mode>(from, marking_state(from))) { | 65 } else if (ObjectMarking::IsBlack<access_mode>(from, marking_state(from))) { |
66 ObjectMarking::WhiteToBlack<access_mode>(to, marking_state(to)); | 66 bool success = |
67 ObjectMarking::WhiteToBlack<access_mode>(to, marking_state(to)); | |
68 DCHECK(success); | |
69 USE(success); | |
67 } | 70 } |
68 } | 71 } |
69 | 72 |
70 | 73 |
71 State state() { | 74 State state() { |
72 DCHECK(state_ == STOPPED || FLAG_incremental_marking); | 75 DCHECK(state_ == STOPPED || FLAG_incremental_marking); |
73 return state_; | 76 return state_; |
74 } | 77 } |
75 | 78 |
76 bool should_hurry() { return should_hurry_; } | 79 bool should_hurry() { return should_hurry_; } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 INLINE(void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value)); | 185 INLINE(void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value)); |
183 INLINE(void RecordWriteOfCodeEntry(JSFunction* host, Object** slot, | 186 INLINE(void RecordWriteOfCodeEntry(JSFunction* host, Object** slot, |
184 Code* value)); | 187 Code* value)); |
185 | 188 |
186 void RecordWriteSlow(HeapObject* obj, Object** slot, Object* value); | 189 void RecordWriteSlow(HeapObject* obj, Object** slot, Object* value); |
187 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* value); | 190 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* value); |
188 void RecordWriteOfCodeEntrySlow(JSFunction* host, Object** slot, Code* value); | 191 void RecordWriteOfCodeEntrySlow(JSFunction* host, Object** slot, Code* value); |
189 void RecordCodeTargetPatch(Code* host, Address pc, HeapObject* value); | 192 void RecordCodeTargetPatch(Code* host, Address pc, HeapObject* value); |
190 void RecordCodeTargetPatch(Address pc, HeapObject* value); | 193 void RecordCodeTargetPatch(Address pc, HeapObject* value); |
191 | 194 |
192 void WhiteToGreyAndPush(HeapObject* obj); | 195 bool WhiteToGreyAndPush(HeapObject* obj); |
Michael Lippautz
2017/05/03 07:48:39
nit: Please add a comment indicating what the retu
ulan
2017/05/03 08:51:55
Done.
| |
193 | 196 |
194 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { | 197 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { |
195 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting()); | 198 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting()); |
196 } | 199 } |
197 | 200 |
198 inline void SetNewSpacePageFlags(Page* chunk) { | 201 inline void SetNewSpacePageFlags(Page* chunk) { |
199 SetNewSpacePageFlags(chunk, IsMarking()); | 202 SetNewSpacePageFlags(chunk, IsMarking()); |
200 } | 203 } |
201 | 204 |
202 bool IsCompacting() { return IsMarking() && is_compacting_; } | 205 bool IsCompacting() { return IsMarking() && is_compacting_; } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 | 320 |
318 Observer new_generation_observer_; | 321 Observer new_generation_observer_; |
319 Observer old_generation_observer_; | 322 Observer old_generation_observer_; |
320 | 323 |
321 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); | 324 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); |
322 }; | 325 }; |
323 } // namespace internal | 326 } // namespace internal |
324 } // namespace v8 | 327 } // namespace v8 |
325 | 328 |
326 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ | 329 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ |
OLD | NEW |