Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::RestoreWriteBarrierInvariantVisitor Class Reference
Inheritance diagram for dart::RestoreWriteBarrierInvariantVisitor:
dart::ObjectPointerVisitor

Public Member Functions

 RestoreWriteBarrierInvariantVisitor (IsolateGroup *group, Thread *thread, Thread::RestoreWriteBarrierInvariantOp op)
 
void VisitPointers (ObjectPtr *first, ObjectPtr *last) override
 
- 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)
 
virtual void VisitPointers (ObjectPtr *first, ObjectPtr *last)=0
 
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)
 

Detailed Description

Definition at line 1022 of file thread.cc.

Constructor & Destructor Documentation

◆ RestoreWriteBarrierInvariantVisitor()

dart::RestoreWriteBarrierInvariantVisitor::RestoreWriteBarrierInvariantVisitor ( IsolateGroup group,
Thread thread,
Thread::RestoreWriteBarrierInvariantOp  op 
)
inline

Definition at line 1024 of file thread.cc.

1028 thread_(thread),
1029 current_(Thread::Current()),
1030 op_(op) {}
ObjectPointerVisitor(IsolateGroup *isolate_group)
Definition: visitor.cc:11
static Thread * Current()
Definition: thread.h:362

Member Function Documentation

◆ VisitPointers()

void dart::RestoreWriteBarrierInvariantVisitor::VisitPointers ( ObjectPtr first,
ObjectPtr last 
)
inlineoverridevirtual

Implements dart::ObjectPointerVisitor.

Definition at line 1032 of file thread.cc.

1032 {
1033 for (; first != last + 1; first++) {
1034 ObjectPtr obj = *first;
1035 if (obj->IsImmediateObject()) continue;
1036
1037 // To avoid adding too much work into the remembered set, skip large
1038 // arrays. Write barrier elimination will not remove the barrier
1039 // if we can trigger GC between array allocation and store.
1040 if (obj->GetClassId() == kArrayCid) {
1041 const auto length = Smi::Value(Array::RawCast(obj)->untag()->length());
1043 continue;
1044 }
1045 }
1046
1047 // Dart code won't store into VM-internal objects except Contexts and
1048 // UnhandledExceptions. This assumption is checked by an assertion in
1049 // WriteBarrierElimination::UpdateVectorForBlock.
1050 if (!obj->IsDartInstance() && !obj->IsContext() &&
1051 !obj->IsUnhandledException())
1052 continue;
1053
1054 // Dart code won't store into canonical instances.
1055 if (obj->untag()->IsCanonical()) continue;
1056
1057 // Objects in the VM isolate heap are immutable and won't be
1058 // stored into. Check this condition last because there's no bit
1059 // in the header for it.
1060 if (obj->untag()->InVMIsolateHeap()) continue;
1061
1062 switch (op_) {
1063 case Thread::RestoreWriteBarrierInvariantOp::kAddToRememberedSet:
1064 if (obj->IsOldObject()) {
1065 obj->untag()->EnsureInRememberedSet(current_);
1066 }
1067 if (current_->is_marking()) {
1068 current_->DeferredMarkingStackAddObject(obj);
1069 }
1070 break;
1071 case Thread::RestoreWriteBarrierInvariantOp::kAddToDeferredMarkingStack:
1072 // Re-scan obj when finalizing marking.
1073 ASSERT(current_->is_marking());
1074 current_->DeferredMarkingStackAddObject(obj);
1075 break;
1076 }
1077 }
1078 }
static constexpr intptr_t kMaxLengthForWriteBarrierElimination
Definition: object.h:10827
static ObjectPtr RawCast(ObjectPtr obj)
Definition: object.h:325
intptr_t Value() const
Definition: object.h:9990
void DeferredMarkingStackAddObject(ObjectPtr obj)
Definition: thread.cc:871
bool is_marking() const
Definition: thread.h:676
#define ASSERT(E)
size_t length
raw_obj untag() -> num_entries()) VARIABLE_COMPRESSED_VISITOR(Array, Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(TypedData, TypedData::ElementSizeInBytes(raw_obj->GetClassId()) *Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(Record, RecordShape(raw_obj->untag() ->shape()).num_fields()) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag() ->length())) VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag() ->length())) intptr_t UntaggedField::VisitFieldPointers(FieldPtr raw_obj, ObjectPointerVisitor *visitor)
Definition: raw_object.cc:558

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