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

Public Member Functions

 FinalizeVMIsolateVisitor ()
 
void VisitObject (ObjectPtr obj)
 
- Public Member Functions inherited from dart::ObjectVisitor
 ObjectVisitor ()
 
virtual ~ObjectVisitor ()
 
virtual void VisitObject (ObjectPtr obj)=0
 

Detailed Description

Definition at line 1411 of file object.cc.

Constructor & Destructor Documentation

◆ FinalizeVMIsolateVisitor()

dart::FinalizeVMIsolateVisitor::FinalizeVMIsolateVisitor ( )
inline

Definition at line 1413 of file object.cc.

1415 : counter_(1337)
1416#endif
1417 {
1418 }

Member Function Documentation

◆ VisitObject()

void dart::FinalizeVMIsolateVisitor::VisitObject ( ObjectPtr  obj)
inlinevirtual

Implements dart::ObjectVisitor.

Definition at line 1420 of file object.cc.

1420 {
1421 // Free list elements should never be marked.
1422 ASSERT(!obj->untag()->IsMarked());
1423 // No forwarding corpses in the VM isolate.
1424 ASSERT(!obj->IsForwardingCorpse());
1425 if (!obj->IsFreeListElement()) {
1426 obj->untag()->SetMarkBitUnsynchronized();
1428#if defined(HASH_IN_OBJECT_HEADER)
1429 // These objects end up in the read-only VM isolate which is shared
1430 // between isolates, so we have to prepopulate them with identity hash
1431 // codes, since we can't add hash codes later.
1432 if (Object::GetCachedHash(obj) == 0) {
1433 // Some classes have identity hash codes that depend on their contents,
1434 // not per object.
1435 ASSERT(!obj->IsStringInstance());
1436 if (obj == Object::null()) {
1437 Object::SetCachedHashIfNotSet(obj, kNullIdentityHash);
1438 } else if (obj == Object::bool_true().ptr()) {
1439 Object::SetCachedHashIfNotSet(obj, kTrueIdentityHash);
1440 } else if (obj == Object::bool_false().ptr()) {
1441 Object::SetCachedHashIfNotSet(obj, kFalseIdentityHash);
1442 } else if (!obj->IsMint() && !obj->IsDouble()) {
1443 counter_ += 2011; // The year Dart was announced and a prime.
1444 counter_ &= 0x3fffffff;
1445 if (counter_ == 0) counter_++;
1446 Object::SetCachedHashIfNotSet(obj, counter_);
1447 }
1448 }
1449#endif
1450#if !defined(DART_PRECOMPILED_RUNTIME)
1451 if (obj->IsClass()) {
1452 // Won't be able to update read-only VM isolate classes if implementors
1453 // are discovered later.
1454 static_cast<ClassPtr>(obj)->untag()->implementor_cid_ = kDynamicCid;
1455 }
1456#endif
1457 }
1458 }
static ObjectPtr null()
Definition: object.h:433
static void FinalizeReadOnlyObject(ObjectPtr object)
Definition: object.cc:1556
#define ASSERT(E)
static constexpr intptr_t kNullIdentityHash
Definition: object.h:10784
static constexpr intptr_t kFalseIdentityHash
Definition: object.h:10786
@ kDynamicCid
Definition: class_id.h:253
static constexpr intptr_t kTrueIdentityHash
Definition: object.h:10785
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: