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

Public Member Functions

 VMSerializationRoots (const WeakArray &symbols, bool should_write_symbols)
 
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 6804 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ VMSerializationRoots()

dart::VMSerializationRoots::VMSerializationRoots ( const WeakArray symbols,
bool  should_write_symbols 
)
inlineexplicit

Definition at line 6806 of file app_snapshot.cc.

6808 : symbols_(symbols),
6809 should_write_symbols_(should_write_symbols),
6810 zone_(Thread::Current()->zone()) {}
static Thread * Current()
Definition: thread.h:362

Member Function Documentation

◆ AddBaseObjects()

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

Implements dart::SerializationRoots.

Definition at line 6812 of file app_snapshot.cc.

6812 {
6813 // These objects are always allocated by Object::InitOnce, so they are not
6814 // written into the snapshot.
6815
6816 s->AddBaseObject(Object::null(), "Null", "null");
6817 s->AddBaseObject(Object::sentinel().ptr(), "Null", "sentinel");
6818 s->AddBaseObject(Object::transition_sentinel().ptr(), "Null",
6819 "transition_sentinel");
6820 s->AddBaseObject(Object::optimized_out().ptr(), "Null", "<optimized out>");
6821 s->AddBaseObject(Object::empty_array().ptr(), "Array", "<empty_array>");
6822 s->AddBaseObject(Object::empty_instantiations_cache_array().ptr(), "Array",
6823 "<empty_instantiations_cache_array>");
6824 s->AddBaseObject(Object::empty_subtype_test_cache_array().ptr(), "Array",
6825 "<empty_subtype_test_cache_array>");
6826 s->AddBaseObject(Object::dynamic_type().ptr(), "Type", "<dynamic type>");
6827 s->AddBaseObject(Object::void_type().ptr(), "Type", "<void type>");
6828 s->AddBaseObject(Object::empty_type_arguments().ptr(), "TypeArguments",
6829 "[]");
6830 s->AddBaseObject(Bool::True().ptr(), "bool", "true");
6831 s->AddBaseObject(Bool::False().ptr(), "bool", "false");
6832 ASSERT(Object::synthetic_getter_parameter_types().ptr() != Object::null());
6833 s->AddBaseObject(Object::synthetic_getter_parameter_types().ptr(), "Array",
6834 "<synthetic getter parameter types>");
6835 ASSERT(Object::synthetic_getter_parameter_names().ptr() != Object::null());
6836 s->AddBaseObject(Object::synthetic_getter_parameter_names().ptr(), "Array",
6837 "<synthetic getter parameter names>");
6838 s->AddBaseObject(Object::empty_context_scope().ptr(), "ContextScope",
6839 "<empty>");
6840 s->AddBaseObject(Object::empty_object_pool().ptr(), "ObjectPool",
6841 "<empty>");
6842 s->AddBaseObject(Object::empty_compressed_stackmaps().ptr(),
6843 "CompressedStackMaps", "<empty>");
6844 s->AddBaseObject(Object::empty_descriptors().ptr(), "PcDescriptors",
6845 "<empty>");
6846 s->AddBaseObject(Object::empty_var_descriptors().ptr(),
6847 "LocalVarDescriptors", "<empty>");
6848 s->AddBaseObject(Object::empty_exception_handlers().ptr(),
6849 "ExceptionHandlers", "<empty>");
6850 s->AddBaseObject(Object::empty_async_exception_handlers().ptr(),
6851 "ExceptionHandlers", "<empty async>");
6852
6853 for (intptr_t i = 0; i < ArgumentsDescriptor::kCachedDescriptorCount; i++) {
6854 s->AddBaseObject(ArgumentsDescriptor::cached_args_descriptors_[i],
6855 "ArgumentsDescriptor", "<cached arguments descriptor>");
6856 }
6857 for (intptr_t i = 0; i < ICData::kCachedICDataArrayCount; i++) {
6858 s->AddBaseObject(ICData::cached_icdata_arrays_[i], "Array",
6859 "<empty icdata entries>");
6860 }
6861
6862 ClassTable* table = s->isolate_group()->class_table();
6864 cid++) {
6865 // Error, CallSiteData has no class object.
6866 if (cid != kErrorCid && cid != kCallSiteDataCid) {
6867 ASSERT(table->HasValidClassAt(cid));
6868 s->AddBaseObject(
6869 table->At(cid), "Class",
6870 Class::Handle(table->At(cid))
6871 .NameCString(Object::NameVisibility::kInternalName));
6872 }
6873 }
6874 s->AddBaseObject(table->At(kDynamicCid), "Class", "dynamic");
6875 s->AddBaseObject(table->At(kVoidCid), "Class", "void");
6876
6877 if (!Snapshot::IncludesCode(s->kind())) {
6878 for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
6879 s->AddBaseObject(StubCode::EntryAt(i).ptr());
6880 }
6881 }
6882 }
SI F table(const skcms_Curve *curve, F v)
static const Bool & False()
Definition: object.h:10799
static const Bool & True()
Definition: object.h:10797
@ kCachedICDataArrayCount
Definition: object.h:2776
static ObjectPtr null()
Definition: object.h:433
ObjectPtr ptr() const
Definition: object.h:332
static Object & Handle()
Definition: object.h:407
static bool IncludesCode(Kind kind)
Definition: snapshot.h:67
static const Code & EntryAt(intptr_t index)
Definition: stub_code.h:101
static intptr_t NumEntries()
Definition: stub_code.h:107
#define ASSERT(E)
struct MyStruct s
@ kVoidCid
Definition: class_id.h:254
@ kDynamicCid
Definition: class_id.h:253
constexpr intptr_t kFirstInternalOnlyCid
Definition: class_id.h:288
const intptr_t cid
constexpr intptr_t kLastInternalOnlyCid
Definition: class_id.h:289

◆ PushRoots()

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

Implements dart::SerializationRoots.

Definition at line 6884 of file app_snapshot.cc.

6884 {
6885 if (should_write_symbols_) {
6886 s->Push(symbols_.ptr());
6887 } else {
6888 for (intptr_t i = 0; i < symbols_.Length(); i++) {
6889 s->Push(symbols_.At(i));
6890 }
6891 }
6892 if (Snapshot::IncludesCode(s->kind())) {
6893 for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
6894 s->Push(StubCode::EntryAt(i).ptr());
6895 }
6896 }
6897 }
intptr_t Length() const
Definition: object.h:6697
ObjectPtr At(intptr_t index) const
Definition: object.h:6722

◆ WriteRoots()

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

Implements dart::SerializationRoots.

Definition at line 6899 of file app_snapshot.cc.

6899 {
6900 s->WriteRootRef(should_write_symbols_ ? symbols_.ptr() : Object::null(),
6901 "symbol-table");
6902 if (Snapshot::IncludesCode(s->kind())) {
6903 for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
6904 s->WriteRootRef(StubCode::EntryAt(i).ptr(),
6905 zone_->PrintToString("Stub:%s", StubCode::NameAt(i)));
6906 }
6907 }
6908
6909 if (!should_write_symbols_ && s->profile_writer() != nullptr) {
6910 // If writing V8 snapshot profile create an artificial node representing
6911 // VM isolate symbol table.
6912 ASSERT(!s->IsReachable(symbols_.ptr()));
6913 s->AssignArtificialRef(symbols_.ptr());
6914 const auto& symbols_snapshot_id = s->GetProfileId(symbols_.ptr());
6915 s->profile_writer()->SetObjectTypeAndName(symbols_snapshot_id, "Symbols",
6916 "vm_symbols");
6917 s->profile_writer()->AddRoot(symbols_snapshot_id);
6918 for (intptr_t i = 0; i < symbols_.Length(); i++) {
6919 s->profile_writer()->AttributeReferenceTo(
6920 symbols_snapshot_id, V8SnapshotProfileWriter::Reference::Element(i),
6921 s->GetProfileId(symbols_.At(i)));
6922 }
6923 }
6924 }
static const char * NameAt(intptr_t index)
Definition: stub_code.h:99
char * PrintToString(const char *format,...) PRINTF_ATTRIBUTE(2
Definition: zone.cc:313
static Reference Element(intptr_t offset)

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