5 #ifndef V8_HEAP_INCREMENTAL_MARKING_INL_H_ 6 #define V8_HEAP_INCREMENTAL_MARKING_INL_H_ 8 #include "src/heap/incremental-marking.h" 10 #include "src/heap/mark-compact-inl.h" 11 #include "src/isolate.h" 12 #include "src/objects-inl.h" 13 #include "src/objects/maybe-object.h" 18 void IncrementalMarking::TransferColor(HeapObject* from, HeapObject* to) {
19 if (atomic_marking_state()->IsBlack(to)) {
20 DCHECK(black_allocation());
24 DCHECK(atomic_marking_state()->IsWhite(to));
25 if (atomic_marking_state()->IsGrey(from)) {
26 bool success = atomic_marking_state()->WhiteToGrey(to);
29 }
else if (atomic_marking_state()->IsBlack(from)) {
30 bool success = atomic_marking_state()->WhiteToBlack(to);
36 void IncrementalMarking::RecordWrite(HeapObject* obj, ObjectSlot slot,
38 DCHECK_IMPLIES(slot.address() != kNullAddress, !HasWeakHeapObjectTag(*slot));
39 DCHECK(!HasWeakHeapObjectTag(value));
40 if (IsMarking() && value->IsHeapObject()) {
41 RecordWriteSlow(obj, HeapObjectSlot(slot), HeapObject::cast(value));
45 void IncrementalMarking::RecordMaybeWeakWrite(HeapObject* obj,
50 HeapObject* heap_object;
51 if (IsMarking() && value->GetHeapObject(&heap_object)) {
52 RecordWriteSlow(obj, HeapObjectSlot(slot), heap_object);
56 void IncrementalMarking::RestartIfNotMarking() {
57 if (state_ == COMPLETE) {
59 if (FLAG_trace_incremental_marking) {
60 heap()->isolate()->PrintWithTimestamp(
61 "[IncrementalMarking] Restarting (new grey objects)\n");
69 #endif // V8_HEAP_INCREMENTAL_MARKING_INL_H_