Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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)
 
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 955 of file thread.cc.

Constructor & Destructor Documentation

◆ RestoreWriteBarrierInvariantVisitor()

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

Definition at line 957 of file thread.cc.

960 : ObjectPointerVisitor(group),
961 thread_(thread),
962 current_(Thread::Current()),
963 op_(op) {}
ObjectPointerVisitor(IsolateGroup *isolate_group)
Definition visitor.cc:11
static Thread * Current()
Definition thread.h:361

Member Function Documentation

◆ VisitPointers()

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

Implements dart::ObjectPointerVisitor.

Definition at line 965 of file thread.cc.

965 {
966 for (; first != last + 1; first++) {
967 ObjectPtr obj = *first;
968 // Stores into new-space objects don't need a write barrier.
969 if (obj->IsImmediateObject()) continue;
970
971 // To avoid adding too much work into the remembered set, skip large
972 // arrays. Write barrier elimination will not remove the barrier
973 // if we can trigger GC between array allocation and store.
974 if (obj->GetClassId() == kArrayCid) {
975 const auto length = Smi::Value(Array::RawCast(obj)->untag()->length());
977 continue;
978 }
979 }
980
981 // Dart code won't store into VM-internal objects except Contexts and
982 // UnhandledExceptions. This assumption is checked by an assertion in
983 // WriteBarrierElimination::UpdateVectorForBlock.
984 if (!obj->IsDartInstance() && !obj->IsContext() &&
985 !obj->IsUnhandledException())
986 continue;
987
988 // Dart code won't store into canonical instances.
989 if (obj->untag()->IsCanonical()) continue;
990
991 // Objects in the VM isolate heap are immutable and won't be
992 // stored into. Check this condition last because there's no bit
993 // in the header for it.
994 if (obj->untag()->InVMIsolateHeap()) continue;
995
996 switch (op_) {
997 case Thread::RestoreWriteBarrierInvariantOp::kAddToRememberedSet:
998 if (obj->IsOldObject()) {
999 obj->untag()->EnsureInRememberedSet(current_);
1000 }
1001 if (current_->is_marking()) {
1002 current_->DeferredMarkingStackAddObject(obj);
1003 }
1004 break;
1005 case Thread::RestoreWriteBarrierInvariantOp::kAddToDeferredMarkingStack:
1006 // Re-scan obj when finalizing marking.
1007 ASSERT(current_->is_marking());
1008 current_->DeferredMarkingStackAddObject(obj);
1009 break;
1010 }
1011 }
1012 }
static constexpr intptr_t kMaxLengthForWriteBarrierElimination
Definition object.h:10806
static ObjectPtr RawCast(ObjectPtr obj)
Definition object.h:325
intptr_t Value() const
Definition object.h:9969
void DeferredMarkingStackAddObject(ObjectPtr obj)
Definition thread.cc:833
bool is_marking() const
Definition thread.h:669
#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)

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