Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
dart::MarkingVisitorBase< sync > Class Template Reference
Inheritance diagram for dart::MarkingVisitorBase< sync >:
dart::ObjectPointerVisitor

Public Member Functions

 MarkingVisitorBase (IsolateGroup *isolate_group, PageSpace *page_space, MarkingStack *marking_stack, MarkingStack *new_marking_stack, MarkingStack *deferred_marking_stack)
 
 ~MarkingVisitorBase ()
 
uintptr_t marked_bytes () const
 
int64_t marked_micros () const
 
void AddMicros (int64_t micros)
 
void set_concurrent (bool value)
 
bool ProcessPendingWeakProperties ()
 
void DrainMarkingStackWithPauseChecks ()
 
void DrainMarkingStack ()
 
void ProcessMarkingStackUntil (int64_t deadline)
 
bool ProcessMarkingStack (intptr_t remaining_budget)
 
NO_SANITIZE_THREAD ObjectPtr LoadPointerIgnoreRace (ObjectPtr *ptr)
 
NO_SANITIZE_THREAD CompressedObjectPtr LoadCompressedPointerIgnoreRace (CompressedObjectPtr *ptr)
 
void VisitPointers (ObjectPtr *first, ObjectPtr *last) override
 
intptr_t ProcessWeakProperty (WeakPropertyPtr raw_weak)
 
intptr_t ProcessWeakReference (WeakReferencePtr raw_weak)
 
intptr_t ProcessWeakArray (WeakArrayPtr raw_weak)
 
intptr_t ProcessFinalizerEntry (FinalizerEntryPtr raw_entry)
 
void ProcessDeferredMarking ()
 
void FinalizeMarking ()
 
void MournWeakProperties ()
 
void MournWeakReferences ()
 
void MournWeakArrays ()
 
void MournFinalizerEntries ()
 
bool WaitForWork (RelaxedAtomic< uintptr_t > *num_busy)
 
void Flush (GCLinkedLists *global_list)
 
void Adopt (GCLinkedLists *other)
 
void AbandonWork ()
 
void FinalizeIncremental (GCLinkedLists *global_list)
 
GCLinkedListsdelayed ()
 
- Public Member Functions inherited from dart::ObjectPointerVisitor
 ObjectPointerVisitor (IsolateGroup *isolate_group)
 
virtual ~ObjectPointerVisitor ()
 
IsolateGroupisolate_group () const
 
virtual void VisitTypedDataViewPointers (TypedDataViewPtr view, CompressedObjectPtr *first, CompressedObjectPtr *last)
 
void VisitCompressedPointers (uword heap_base, CompressedObjectPtr *first, CompressedObjectPtr *last)
 
void VisitPointers (ObjectPtr *p, intptr_t len)
 
void VisitPointer (ObjectPtr *p)
 
const char * gc_root_type () const
 
void set_gc_root_type (const char *gc_root_type)
 
void clear_gc_root_type ()
 
virtual bool visit_weak_persistent_handles () const
 
virtual bool trace_values_through_fields () const
 
const ClassTableclass_table () const
 
virtual bool CanVisitSuspendStatePointers (SuspendStatePtr suspend_state)
 

Static Public Member Functions

static bool IsMarked (ObjectPtr raw)
 
static bool ForwardOrSetNullIfCollected (ObjectPtr parent, CompressedObjectPtr *slot)
 

Detailed Description

template<bool sync>
class dart::MarkingVisitorBase< sync >

Definition at line 28 of file marker.cc.

Constructor & Destructor Documentation

◆ MarkingVisitorBase()

template<bool sync>
dart::MarkingVisitorBase< sync >::MarkingVisitorBase ( IsolateGroup isolate_group,
PageSpace page_space,
MarkingStack marking_stack,
MarkingStack new_marking_stack,
MarkingStack deferred_marking_stack 
)
inline

Definition at line 30 of file marker.cc.

36 page_space_(page_space),
37 work_list_(marking_stack),
38 new_work_list_(new_marking_stack),
39 deferred_work_list_(deferred_marking_stack),
40 marked_bytes_(0),
41 marked_micros_(0),
42 concurrent_(true) {}
IsolateGroup * isolate_group() const
Definition visitor.h:25
ObjectPointerVisitor(IsolateGroup *isolate_group)
Definition visitor.cc:11

◆ ~MarkingVisitorBase()

template<bool sync>
dart::MarkingVisitorBase< sync >::~MarkingVisitorBase ( )
inline

Definition at line 43 of file marker.cc.

43{ ASSERT(delayed_.IsEmpty()); }
#define ASSERT(E)

Member Function Documentation

◆ AbandonWork()

template<bool sync>
void dart::MarkingVisitorBase< sync >::AbandonWork ( )
inline

Definition at line 450 of file marker.cc.

450 {
451 work_list_.AbandonWork();
452 new_work_list_.AbandonWork();
453 deferred_work_list_.AbandonWork();
454 delayed_.Release();
455 }

◆ AddMicros()

template<bool sync>
void dart::MarkingVisitorBase< sync >::AddMicros ( int64_t  micros)
inline

Definition at line 47 of file marker.cc.

47{ marked_micros_ += micros; }

◆ Adopt()

template<bool sync>
void dart::MarkingVisitorBase< sync >::Adopt ( GCLinkedLists other)
inline

Definition at line 445 of file marker.cc.

445 {
446 ASSERT(delayed_.IsEmpty());
447 other->FlushInto(&delayed_);
448 }

◆ delayed()

template<bool sync>
GCLinkedLists * dart::MarkingVisitorBase< sync >::delayed ( )
inline

Definition at line 467 of file marker.cc.

467{ return &delayed_; }

◆ DrainMarkingStack()

template<bool sync>
void dart::MarkingVisitorBase< sync >::DrainMarkingStack ( )
inline

Definition at line 149 of file marker.cc.

149 {
151 }
152 }
bool ProcessMarkingStack(intptr_t remaining_budget)
Definition marker.cc:172
constexpr intptr_t kIntptrMax
Definition globals.h:557

◆ DrainMarkingStackWithPauseChecks()

template<bool sync>
void dart::MarkingVisitorBase< sync >::DrainMarkingStackWithPauseChecks ( )
inline

Definition at line 88 of file marker.cc.

88 {
89 do {
90 ObjectPtr obj;
91 while (work_list_.Pop(&obj)) {
92 if (obj->IsNewObject()) {
93 Page* page = Page::Of(obj);
94 uword top = page->original_top();
95 uword end = page->original_end();
96 uword addr = static_cast<uword>(obj);
97 if (top <= addr && addr < end) {
98 new_work_list_.Push(obj);
99 if (UNLIKELY(page_space_->pause_concurrent_marking())) {
100 work_list_.Flush();
101 new_work_list_.Flush();
102 deferred_work_list_.Flush();
103 page_space_->YieldConcurrentMarking();
104 }
105 continue;
106 }
107 }
108
109 const intptr_t class_id = obj->GetClassId();
110 ASSERT(class_id != kIllegalCid);
111 ASSERT(class_id != kFreeListElement);
112 ASSERT(class_id != kForwardingCorpse);
113
114 intptr_t size;
115 if (class_id == kWeakPropertyCid) {
116 size = ProcessWeakProperty(static_cast<WeakPropertyPtr>(obj));
117 } else if (class_id == kWeakReferenceCid) {
118 size = ProcessWeakReference(static_cast<WeakReferencePtr>(obj));
119 } else if (class_id == kWeakArrayCid) {
120 size = ProcessWeakArray(static_cast<WeakArrayPtr>(obj));
121 } else if (class_id == kFinalizerEntryCid) {
122 size = ProcessFinalizerEntry(static_cast<FinalizerEntryPtr>(obj));
123 } else if (sync && concurrent_ && class_id == kSuspendStateCid) {
124 // Shape changing is not compatible with concurrent marking.
125 deferred_work_list_.Push(obj);
126 size = obj->untag()->HeapSize();
127 } else {
128 size = obj->untag()->VisitPointersNonvirtual(this);
129 }
130 if (!obj->IsNewObject()) {
131 marked_bytes_ += size;
132 }
133
134 if (UNLIKELY(page_space_->pause_concurrent_marking())) {
135 work_list_.Flush();
136 new_work_list_.Flush();
137 deferred_work_list_.Flush();
138 page_space_->YieldConcurrentMarking();
139 }
140 }
142
143 ASSERT(work_list_.IsLocalEmpty());
144 // In case of scavenge before final marking.
145 new_work_list_.Flush();
146 deferred_work_list_.Flush();
147 }
void Push(ObjectPtr raw_obj)
bool Pop(ObjectPtr *object)
intptr_t ProcessWeakProperty(WeakPropertyPtr raw_weak)
Definition marker.cc:273
intptr_t ProcessWeakArray(WeakArrayPtr raw_weak)
Definition marker.cc:308
intptr_t ProcessWeakReference(WeakReferencePtr raw_weak)
Definition marker.cc:288
intptr_t ProcessFinalizerEntry(FinalizerEntryPtr raw_entry)
Definition marker.cc:313
bool ProcessPendingWeakProperties()
Definition marker.cc:59
bool pause_concurrent_marking() const
Definition pages.h:333
void YieldConcurrentMarking()
Definition pages.cc:453
static Page * Of(ObjectPtr obj)
Definition page.h:141
glong glong end
@ kForwardingCorpse
Definition class_id.h:225
@ kIllegalCid
Definition class_id.h:214
@ kFreeListElement
Definition class_id.h:224
uintptr_t uword
Definition globals.h:501
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259
#define UNLIKELY(cond)
Definition globals.h:261

◆ FinalizeIncremental()

template<bool sync>
void dart::MarkingVisitorBase< sync >::FinalizeIncremental ( GCLinkedLists global_list)
inline

Definition at line 457 of file marker.cc.

457 {
458 work_list_.Flush();
459 work_list_.Finalize();
460 new_work_list_.Flush();
461 new_work_list_.Finalize();
462 deferred_work_list_.Flush();
463 deferred_work_list_.Finalize();
464 delayed_.FlushInto(global_list);
465 }
void FlushInto(GCLinkedLists *to)
Definition gc_shared.cc:34

◆ FinalizeMarking()

template<bool sync>
void dart::MarkingVisitorBase< sync >::FinalizeMarking ( )
inline

Definition at line 359 of file marker.cc.

359 {
360 work_list_.Finalize();
361 new_work_list_.Finalize();
362 deferred_work_list_.Finalize();
364 // MournFinalizerEntries inserts newly discovered dead entries into the
365 // linked list attached to the Finalizer. This might create
366 // cross-generational references which might be added to the store
367 // buffer. Release the store buffer to satisfy the invariant that
368 // thread local store buffer is empty after marking and all references
369 // are processed.
371 }
static Thread * Current()
Definition thread.h:361
void ReleaseStoreBuffer()
Definition thread.cc:672

◆ Flush()

template<bool sync>
void dart::MarkingVisitorBase< sync >::Flush ( GCLinkedLists global_list)
inline

Definition at line 438 of file marker.cc.

438 {
439 work_list_.Flush();
440 new_work_list_.Flush();
441 deferred_work_list_.Flush();
442 delayed_.FlushInto(global_list);
443 }

◆ ForwardOrSetNullIfCollected()

template<bool sync>
static bool dart::MarkingVisitorBase< sync >::ForwardOrSetNullIfCollected ( ObjectPtr  parent,
CompressedObjectPtr slot 
)
inlinestatic

Definition at line 418 of file marker.cc.

419 {
420 ObjectPtr target = slot->Decompress(parent->heap_base());
421 if (target->IsImmediateObject()) {
422 // Object not touched during this GC.
423 return false;
424 }
425 if (target->untag()->IsMarked()) {
426 // Object already null (which is permanently marked) or has survived this
427 // GC.
428 return false;
429 }
430 *slot = Object::null();
431 return true;
432 }
static ObjectPtr null()
Definition object.h:433
uint32_t * target

◆ IsMarked()

template<bool sync>
static bool dart::MarkingVisitorBase< sync >::IsMarked ( ObjectPtr  raw)
inlinestatic

Definition at line 54 of file marker.cc.

54 {
55 ASSERT(raw->IsHeapObject());
56 return raw->untag()->IsMarked();
57 }

◆ LoadCompressedPointerIgnoreRace()

template<bool sync>
NO_SANITIZE_THREAD CompressedObjectPtr dart::MarkingVisitorBase< sync >::LoadCompressedPointerIgnoreRace ( CompressedObjectPtr ptr)
inline

Definition at line 251 of file marker.cc.

252 {
253 return *ptr;
254 }

◆ LoadPointerIgnoreRace()

template<bool sync>
NO_SANITIZE_THREAD ObjectPtr dart::MarkingVisitorBase< sync >::LoadPointerIgnoreRace ( ObjectPtr ptr)
inline

Definition at line 249 of file marker.cc.

249{ return *ptr; }

◆ marked_bytes()

template<bool sync>
uintptr_t dart::MarkingVisitorBase< sync >::marked_bytes ( ) const
inline

Definition at line 45 of file marker.cc.

45{ return marked_bytes_; }

◆ marked_micros()

template<bool sync>
int64_t dart::MarkingVisitorBase< sync >::marked_micros ( ) const
inline

Definition at line 46 of file marker.cc.

46{ return marked_micros_; }

◆ MournFinalizerEntries()

template<bool sync>
void dart::MarkingVisitorBase< sync >::MournFinalizerEntries ( )
inline

Definition at line 407 of file marker.cc.

407 {
408 FinalizerEntryPtr current = delayed_.finalizer_entries.Release();
409 while (current != FinalizerEntry::null()) {
410 FinalizerEntryPtr next = current->untag()->next_seen_by_gc();
411 current->untag()->next_seen_by_gc_ = FinalizerEntry::null();
412 MournFinalizerEntry(this, current);
413 current = next;
414 }
415 }
static float next(float f)
void MournFinalizerEntry(GCVisitorType *visitor, FinalizerEntryPtr current_entry)
Definition gc_shared.h:162

◆ MournWeakArrays()

template<bool sync>
void dart::MarkingVisitorBase< sync >::MournWeakArrays ( )
inline

Definition at line 394 of file marker.cc.

394 {
395 WeakArrayPtr current = delayed_.weak_arrays.Release();
396 while (current != WeakArray::null()) {
397 WeakArrayPtr next = current->untag()->next_seen_by_gc();
398 current->untag()->next_seen_by_gc_ = WeakArray::null();
399 intptr_t length = Smi::Value(current->untag()->length());
400 for (intptr_t i = 0; i < length; i++) {
401 ForwardOrSetNullIfCollected(current, &current->untag()->data()[i]);
402 }
403 current = next;
404 }
405 }
static bool ForwardOrSetNullIfCollected(ObjectPtr parent, CompressedObjectPtr *slot)
Definition marker.cc:418
intptr_t Value() const
Definition object.h:9969
size_t length

◆ MournWeakProperties()

template<bool sync>
void dart::MarkingVisitorBase< sync >::MournWeakProperties ( )
inline

Definition at line 373 of file marker.cc.

373 {
374 WeakPropertyPtr current = delayed_.weak_properties.Release();
375 while (current != WeakProperty::null()) {
376 WeakPropertyPtr next = current->untag()->next_seen_by_gc();
377 current->untag()->next_seen_by_gc_ = WeakProperty::null();
378 current->untag()->key_ = Object::null();
379 current->untag()->value_ = Object::null();
380 current = next;
381 }
382 }

◆ MournWeakReferences()

template<bool sync>
void dart::MarkingVisitorBase< sync >::MournWeakReferences ( )
inline

Definition at line 384 of file marker.cc.

384 {
385 WeakReferencePtr current = delayed_.weak_references.Release();
386 while (current != WeakReference::null()) {
387 WeakReferencePtr next = current->untag()->next_seen_by_gc();
388 current->untag()->next_seen_by_gc_ = WeakReference::null();
389 ForwardOrSetNullIfCollected(current, &current->untag()->target_);
390 current = next;
391 }
392 }

◆ ProcessDeferredMarking()

template<bool sync>
void dart::MarkingVisitorBase< sync >::ProcessDeferredMarking ( )
inline

Definition at line 324 of file marker.cc.

324 {
325 TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "ProcessDeferredMarking");
326
327 ObjectPtr obj;
328 while (deferred_work_list_.Pop(&obj)) {
329 ASSERT(obj->IsHeapObject());
330 // We need to scan objects even if they were already scanned via ordinary
331 // marking. An object may have changed since its ordinary scan and been
332 // added to deferred marking stack to compensate for write-barrier
333 // elimination.
334 // A given object may be included in the deferred marking stack multiple
335 // times. It may or may not also be in the ordinary marking stack, so
336 // failing to acquire the mark bit here doesn't reliably indicate the
337 // object was already encountered through the deferred marking stack. Our
338 // processing here is idempotent, so repeated visits only hurt performance
339 // but not correctness. Duplication is expected to be low.
340 // By the absence of a special case, we are treating WeakProperties as
341 // strong references here. This guarantees a WeakProperty will only be
342 // added to the delayed_weak_properties_ list of the worker that
343 // encounters it during ordinary marking. This is in the same spirit as
344 // the eliminated write barrier, which would have added the newly written
345 // key and value to the ordinary marking stack.
346 intptr_t size = obj->untag()->VisitPointersNonvirtual(this);
347 // Add the size only if we win the marking race to prevent
348 // double-counting.
349 if (TryAcquireMarkBit(obj)) {
350 if (!obj->IsNewObject()) {
351 marked_bytes_ += size;
352 }
353 }
354 }
355 }
#define TIMELINE_FUNCTION_GC_DURATION(thread, name)
Definition timeline.h:41

◆ ProcessFinalizerEntry()

template<bool sync>
intptr_t dart::MarkingVisitorBase< sync >::ProcessFinalizerEntry ( FinalizerEntryPtr  raw_entry)
inline

Definition at line 313 of file marker.cc.

313 {
314 ASSERT(IsMarked(raw_entry));
315 delayed_.finalizer_entries.Enqueue(raw_entry);
316 // Only visit token and next.
317 MarkObject(LoadCompressedPointerIgnoreRace(&raw_entry->untag()->token_)
318 .Decompress(raw_entry->heap_base()));
319 MarkObject(LoadCompressedPointerIgnoreRace(&raw_entry->untag()->next_)
320 .Decompress(raw_entry->heap_base()));
321 return raw_entry->untag()->HeapSize();
322 }
static bool IsMarked(ObjectPtr raw)
Definition marker.cc:54
NO_SANITIZE_THREAD CompressedObjectPtr LoadCompressedPointerIgnoreRace(CompressedObjectPtr *ptr)
Definition marker.cc:251
ObjectPtr Decompress(uword heap_base) const

◆ ProcessMarkingStack()

template<bool sync>
bool dart::MarkingVisitorBase< sync >::ProcessMarkingStack ( intptr_t  remaining_budget)
inline

Definition at line 172 of file marker.cc.

172 {
173 do {
174 // First drain the marking stacks.
175 ObjectPtr obj;
176 while (work_list_.Pop(&obj)) {
177 if (sync && concurrent_ && obj->IsNewObject()) {
178 Page* page = Page::Of(obj);
179 uword top = page->original_top();
180 uword end = page->original_end();
181 uword addr = static_cast<uword>(obj);
182 if (top <= addr && addr < end) {
183 new_work_list_.Push(obj);
184 // We did some work routing this object, but didn't look at any of
185 // its slots.
186 intptr_t size = kObjectAlignment;
187 remaining_budget -= size;
188 if (remaining_budget < 0) {
189 return true; // More to mark.
190 }
191 continue;
192 }
193 }
194
195 const intptr_t class_id = obj->GetClassId();
196 ASSERT(class_id != kIllegalCid);
197 ASSERT(class_id != kFreeListElement);
198 ASSERT(class_id != kForwardingCorpse);
199
200 intptr_t size;
201 if (class_id == kWeakPropertyCid) {
202 size = ProcessWeakProperty(static_cast<WeakPropertyPtr>(obj));
203 } else if (class_id == kWeakReferenceCid) {
204 size = ProcessWeakReference(static_cast<WeakReferencePtr>(obj));
205 } else if (class_id == kWeakArrayCid) {
206 size = ProcessWeakArray(static_cast<WeakArrayPtr>(obj));
207 } else if (class_id == kFinalizerEntryCid) {
208 size = ProcessFinalizerEntry(static_cast<FinalizerEntryPtr>(obj));
209 } else if (sync && concurrent_ && class_id == kSuspendStateCid) {
210 // Shape changing is not compatible with concurrent marking.
211 deferred_work_list_.Push(obj);
212 size = obj->untag()->HeapSize();
213 } else {
214 if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) {
215 size = obj->untag()->HeapSize();
216 if (size > remaining_budget) {
217 work_list_.Push(obj);
218 return true; // More to mark.
219 }
220 }
221 size = obj->untag()->VisitPointersNonvirtual(this);
222 }
223 if (!obj->IsNewObject()) {
224 marked_bytes_ += size;
225 }
226 remaining_budget -= size;
227 if (remaining_budget < 0) {
228 return true; // More to mark.
229 }
230 }
231 // Marking stack is empty.
233
234 return false; // No more work.
235 }
static constexpr intptr_t kObjectAlignment

◆ ProcessMarkingStackUntil()

template<bool sync>
void dart::MarkingVisitorBase< sync >::ProcessMarkingStackUntil ( int64_t  deadline)
inline

Definition at line 154 of file marker.cc.

154 {
155 // We check the clock *before* starting a batch of work, but we want to
156 // *end* work before the deadline. So we compare to the deadline adjusted
157 // by a conservative estimate of the duration of one batch of work.
158 deadline -= 1500;
159
160 // A 512kB budget is chosen to be large enough that we don't waste too much
161 // time on the overhead of exiting ProcessMarkingStack, querying the clock,
162 // and re-entering, and small enough that a few batches can fit in the idle
163 // time between animation frames. This amount of marking takes ~1ms on a
164 // Pixel phone.
165 constexpr intptr_t kBudget = 512 * KB;
166
167 while ((OS::GetCurrentMonotonicMicros() < deadline) &&
168 ProcessMarkingStack(kBudget)) {
169 }
170 }
static int64_t GetCurrentMonotonicMicros()
constexpr intptr_t KB
Definition globals.h:528

◆ ProcessPendingWeakProperties()

template<bool sync>
bool dart::MarkingVisitorBase< sync >::ProcessPendingWeakProperties ( )
inline

Definition at line 59 of file marker.cc.

59 {
60 bool more_to_mark = false;
61 WeakPropertyPtr cur_weak = delayed_.weak_properties.Release();
62 while (cur_weak != WeakProperty::null()) {
63 WeakPropertyPtr next_weak =
64 cur_weak->untag()->next_seen_by_gc_.Decompress(cur_weak->heap_base());
65 ObjectPtr raw_key = cur_weak->untag()->key();
66 // Reset the next pointer in the weak property.
67 cur_weak->untag()->next_seen_by_gc_ = WeakProperty::null();
68 if (raw_key->IsImmediateObject() || raw_key->untag()->IsMarked()) {
69 ObjectPtr raw_val = cur_weak->untag()->value();
70 if (!raw_val->IsImmediateObject() && !raw_val->untag()->IsMarked()) {
71 more_to_mark = true;
72 }
73
74 // The key is marked so we make sure to properly visit all pointers
75 // originating from this weak property.
76 cur_weak->untag()->VisitPointersNonvirtual(this);
77 } else {
78 // Requeue this weak property to be handled later.
79 ASSERT(IsMarked(cur_weak));
80 delayed_.weak_properties.Enqueue(cur_weak);
81 }
82 // Advance to next weak property in the queue.
83 cur_weak = next_weak;
84 }
85 return more_to_mark;
86 }

◆ ProcessWeakArray()

template<bool sync>
intptr_t dart::MarkingVisitorBase< sync >::ProcessWeakArray ( WeakArrayPtr  raw_weak)
inline

Definition at line 308 of file marker.cc.

308 {
309 delayed_.weak_arrays.Enqueue(raw_weak);
310 return raw_weak->untag()->HeapSize();
311 }

◆ ProcessWeakProperty()

template<bool sync>
intptr_t dart::MarkingVisitorBase< sync >::ProcessWeakProperty ( WeakPropertyPtr  raw_weak)
inline

Definition at line 273 of file marker.cc.

273 {
274 // The fate of the weak property is determined by its key.
275 ObjectPtr raw_key =
276 LoadCompressedPointerIgnoreRace(&raw_weak->untag()->key_)
277 .Decompress(raw_weak->heap_base());
278 if (raw_key->IsHeapObject() && !raw_key->untag()->IsMarked()) {
279 // Key was white. Enqueue the weak property.
280 ASSERT(IsMarked(raw_weak));
281 delayed_.weak_properties.Enqueue(raw_weak);
282 return raw_weak->untag()->HeapSize();
283 }
284 // Key is gray or black. Make the weak property black.
285 return raw_weak->untag()->VisitPointersNonvirtual(this);
286 }

◆ ProcessWeakReference()

template<bool sync>
intptr_t dart::MarkingVisitorBase< sync >::ProcessWeakReference ( WeakReferencePtr  raw_weak)
inline

Definition at line 288 of file marker.cc.

288 {
289 // The fate of the target field is determined by the target.
290 // The type arguments always stay alive.
291 ObjectPtr raw_target =
292 LoadCompressedPointerIgnoreRace(&raw_weak->untag()->target_)
293 .Decompress(raw_weak->heap_base());
294 if (raw_target->IsHeapObject() && !raw_target->untag()->IsMarked()) {
295 // Target was white. Enqueue the weak reference. It is potentially dead.
296 // It might still be made alive by weak properties in next rounds.
297 ASSERT(IsMarked(raw_weak));
298 delayed_.weak_references.Enqueue(raw_weak);
299 }
300 // Always visit the type argument.
301 ObjectPtr raw_type_arguments =
302 LoadCompressedPointerIgnoreRace(&raw_weak->untag()->type_arguments_)
303 .Decompress(raw_weak->heap_base());
304 MarkObject(raw_type_arguments);
305 return raw_weak->untag()->HeapSize();
306 }

◆ set_concurrent()

template<bool sync>
void dart::MarkingVisitorBase< sync >::set_concurrent ( bool  value)
inline

Definition at line 48 of file marker.cc.

48{ concurrent_ = value; }
uint8_t value

◆ VisitPointers()

template<bool sync>
void dart::MarkingVisitorBase< sync >::VisitPointers ( ObjectPtr first,
ObjectPtr last 
)
inlineoverridevirtual

Implements dart::ObjectPointerVisitor.

Definition at line 256 of file marker.cc.

256 {
257 for (ObjectPtr* current = first; current <= last; current++) {
258 MarkObject(LoadPointerIgnoreRace(current));
259 }
260 }
NO_SANITIZE_THREAD ObjectPtr LoadPointerIgnoreRace(ObjectPtr *ptr)
Definition marker.cc:249

◆ WaitForWork()

template<bool sync>
bool dart::MarkingVisitorBase< sync >::WaitForWork ( RelaxedAtomic< uintptr_t > *  num_busy)
inline

Definition at line 434 of file marker.cc.

434 {
435 return work_list_.WaitForWork(num_busy);
436 }
bool WaitForWork(RelaxedAtomic< uintptr_t > *num_busy, bool abort=false)

The documentation for this class was generated from the following file: