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

Public Member Functions

 UnitSerializationRoots (LoadingUnitSerializationData *unit)
 
void AddBaseObjects (Serializer *s)
 
void PushRoots (Serializer *s)
 
void WriteRoots (Serializer *s)
 
- Public Member Functions inherited from dart::SerializationRoots
virtual ~SerializationRoots ()
 
virtual void AddBaseObjects (Serializer *serializer)=0
 
virtual void PushRoots (Serializer *serializer)=0
 
virtual void WriteRoots (Serializer *serializer)=0
 
virtual const CompressedStackMapscanonicalized_stack_map_entries () const
 

Detailed Description

Definition at line 7256 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ UnitSerializationRoots()

dart::UnitSerializationRoots::UnitSerializationRoots ( LoadingUnitSerializationData unit)
inlineexplicit

Definition at line 7258 of file app_snapshot.cc.

7259 : unit_(unit) {}

Member Function Documentation

◆ AddBaseObjects()

void dart::UnitSerializationRoots::AddBaseObjects ( Serializer s)
inlinevirtual

Implements dart::SerializationRoots.

Definition at line 7261 of file app_snapshot.cc.

7261 {
7262 ZoneGrowableArray<Object*>* objects = unit_->parent()->objects();
7263 for (intptr_t i = 0; i < objects->length(); i++) {
7264 s->AddBaseObject(objects->At(i)->ptr());
7265 }
7266 }
ZoneGrowableArray< Object * > * objects()
Definition: app_snapshot.h:54
LoadingUnitSerializationData * parent() const
Definition: app_snapshot.h:49
struct MyStruct s

◆ PushRoots()

void dart::UnitSerializationRoots::PushRoots ( Serializer s)
inlinevirtual

Implements dart::SerializationRoots.

Definition at line 7268 of file app_snapshot.cc.

7268 {
7269 for (auto deferred_object : *unit_->deferred_objects()) {
7270 ASSERT(deferred_object->IsCode());
7271 CodePtr code = static_cast<CodePtr>(deferred_object->ptr());
7272 ObjectPoolPtr pool = code->untag()->object_pool_;
7273 if (pool != ObjectPool::null()) {
7274 const intptr_t length = pool->untag()->length_;
7275 uint8_t* entry_bits = pool->untag()->entry_bits();
7276 for (intptr_t i = 0; i < length; i++) {
7277 auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
7278 if (entry_type == ObjectPool::EntryType::kTaggedObject) {
7279 s->Push(pool->untag()->data()[i].raw_obj_);
7280 }
7281 }
7282 }
7283 s->Push(code->untag()->code_source_map_);
7284 }
7285 }
AutoreleasePool pool
static constexpr T decode(S value)
Definition: bitfield.h:171
GrowableArray< Code * > * deferred_objects()
Definition: app_snapshot.h:53
static ObjectPtr null()
Definition: object.h:433
#define ASSERT(E)
size_t length

◆ WriteRoots()

void dart::UnitSerializationRoots::WriteRoots ( Serializer s)
inlinevirtual

Implements dart::SerializationRoots.

Definition at line 7287 of file app_snapshot.cc.

7287 {
7288#if defined(DART_PRECOMPILER)
7289 intptr_t start_index = 0;
7290 intptr_t num_deferred_objects = unit_->deferred_objects()->length();
7291 if (num_deferred_objects != 0) {
7292 start_index = s->RefId(unit_->deferred_objects()->At(0)->ptr());
7293 ASSERT(start_index > 0);
7294 }
7295 s->WriteUnsigned(start_index);
7296 s->WriteUnsigned(num_deferred_objects);
7297 for (intptr_t i = 0; i < num_deferred_objects; i++) {
7298 const Object* deferred_object = (*unit_->deferred_objects())[i];
7299 ASSERT(deferred_object->IsCode());
7300 CodePtr code = static_cast<CodePtr>(deferred_object->ptr());
7301 ASSERT(s->RefId(code) == (start_index + i));
7303 s->WriteInstructions(code->untag()->instructions_,
7304 code->untag()->unchecked_offset_, code, false);
7305 s->WriteRootRef(code->untag()->code_source_map_, "deferred-code");
7306 }
7307
7308 ObjectPoolPtr pool =
7309 s->isolate_group()->object_store()->global_object_pool();
7310 const intptr_t length = pool->untag()->length_;
7311 uint8_t* entry_bits = pool->untag()->entry_bits();
7312 intptr_t last_write = 0;
7313 for (intptr_t i = 0; i < length; i++) {
7314 auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
7315 if (entry_type == ObjectPool::EntryType::kTaggedObject) {
7316 if (s->IsWritten(pool->untag()->data()[i].raw_obj_)) {
7317 intptr_t skip = i - last_write;
7318 s->WriteUnsigned(skip);
7319 s->WriteRootRef(pool->untag()->data()[i].raw_obj_,
7320 "deferred-literal");
7321 last_write = i;
7322 }
7323 }
7324 }
7325 s->WriteUnsigned(length - last_write);
7326#endif
7327 }
static bool skip(SkStream *stream, size_t amount)
static bool IsDiscarded(const CodePtr code)
Definition: object.h:6834

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