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

Public Member Functions

 CidRewriteVisitor (intptr_t *old_to_new_cids)
 
intptr_t Map (intptr_t cid)
 
void VisitObject (ObjectPtr obj) override
 
- Public Member Functions inherited from dart::ObjectVisitor
 ObjectVisitor ()
 
virtual ~ObjectVisitor ()
 
virtual void VisitObject (ObjectPtr obj)=0
 

Detailed Description

Definition at line 1024 of file class_finalizer.cc.

Constructor & Destructor Documentation

◆ CidRewriteVisitor()

dart::CidRewriteVisitor::CidRewriteVisitor ( intptr_t *  old_to_new_cids)
inlineexplicit

Definition at line 1026 of file class_finalizer.cc.

1027 : old_to_new_cids_(old_to_new_cids) {}

Member Function Documentation

◆ Map()

intptr_t dart::CidRewriteVisitor::Map ( intptr_t  cid)
inline

Definition at line 1029 of file class_finalizer.cc.

1029 {
1030 ASSERT(cid != -1);
1031 return old_to_new_cids_[cid];
1032 }
#define ASSERT(E)
const intptr_t cid

◆ VisitObject()

void dart::CidRewriteVisitor::VisitObject ( ObjectPtr  obj)
inlineoverridevirtual

Implements dart::ObjectVisitor.

Definition at line 1034 of file class_finalizer.cc.

1034 {
1035 if (obj->IsClass()) {
1036 ClassPtr cls = Class::RawCast(obj);
1037 const classid_t old_cid = cls->untag()->id_;
1038 if (ClassTable::IsTopLevelCid(old_cid)) {
1039 // We don't remap cids of top level classes.
1040 return;
1041 }
1042 cls->untag()->id_ = Map(old_cid);
1043 cls->untag()->implementor_cid_ = Map(cls->untag()->implementor_cid_);
1044 } else if (obj->IsField()) {
1045 FieldPtr field = Field::RawCast(obj);
1046 field->untag()->guarded_cid_ = Map(field->untag()->guarded_cid_);
1047 field->untag()->is_nullable_ = Map(field->untag()->is_nullable_);
1048 } else if (obj->IsTypeParameter()) {
1049 TypeParameterPtr param = TypeParameter::RawCast(obj);
1051 param->untag()->flags())) {
1052 param->untag()->set_owner(
1053 Smi::New(Map(Smi::Value(Smi::RawCast(param->untag()->owner())))));
1054 }
1055 } else if (obj->IsType()) {
1056 TypePtr type = Type::RawCast(obj);
1057 type->untag()->set_type_class_id(Map(type->untag()->type_class_id()));
1058 } else {
1059 intptr_t old_cid = obj->GetClassId();
1060 intptr_t new_cid = Map(old_cid);
1061 if (old_cid != new_cid) {
1062 // Don't touch objects that are unchanged. In particular, Instructions,
1063 // which are write-protected.
1064 obj->untag()->SetClassIdUnsynchronized(new_cid);
1065 }
1066 }
1067 }
GLenum type
static constexpr T decode(S value)
Definition: bitfield.h:171
intptr_t Map(intptr_t cid)
static bool IsTopLevelCid(intptr_t cid)
Definition: class_table.h:496
static ObjectPtr RawCast(ObjectPtr obj)
Definition: object.h:325
static SmiPtr New(intptr_t value)
Definition: object.h:10006
intptr_t Value() const
Definition: object.h:9990
int32_t classid_t
Definition: globals.h:524

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