| Index: runtime/vm/raw_object_snapshot.cc
|
| diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
|
| index 405c2e4fe1b1a5a24320edc4d8a1a23de367f216..81c018c45f68d1326c737fd4ea853f85ccef66c6 100644
|
| --- a/runtime/vm/raw_object_snapshot.cc
|
| +++ b/runtime/vm/raw_object_snapshot.cc
|
| @@ -115,6 +115,7 @@ void RawClass::WriteTo(SnapshotWriter* writer,
|
| // Write out all the non object pointer fields.
|
| // NOTE: cpp_vtable_ is not written.
|
| classid_t class_id = ptr()->id_;
|
| + ASSERT(class_id != kIllegalCid);
|
| writer->Write<classid_t>(class_id);
|
| if (!RawObject::IsInternalVMdefinedClassId(class_id)) {
|
| // We don't write the instance size of VM defined classes as they
|
| @@ -1290,6 +1291,7 @@ void RawLibrary::WriteTo(SnapshotWriter* writer,
|
| } else {
|
| ASSERT((kind == Snapshot::kFull) || !ptr()->is_in_fullsnapshot_);
|
| // Write out all non object fields.
|
| + ASSERT(ptr()->index_ != static_cast<classid_t>(-1));
|
| writer->WriteClassIDValue(ptr()->index_);
|
| writer->Write<uint16_t>(ptr()->num_imports_);
|
| writer->Write<int8_t>(ptr()->load_state_);
|
| @@ -1330,9 +1332,18 @@ RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader,
|
| prefix.StoreNonPointer(&prefix.raw_ptr()->is_loaded_, reader->Read<bool>());
|
|
|
| // Set all the object fields.
|
| + RawObject** toobj = reader->snapshot_code()
|
| + ? prefix.raw()->to_precompiled_snapshot()
|
| + : prefix.raw()->to();
|
| READ_OBJECT_FIELDS(prefix,
|
| - prefix.raw()->from(), prefix.raw()->to(),
|
| + prefix.raw()->from(), toobj,
|
| kAsReference);
|
| + if (reader->snapshot_code()) {
|
| + prefix.StorePointer(&prefix.raw_ptr()->imports_,
|
| + Array::null());
|
| + prefix.StorePointer(&prefix.raw_ptr()->dependent_code_,
|
| + Array::null());
|
| + }
|
|
|
| return prefix.raw();
|
| }
|
| @@ -1359,7 +1370,9 @@ void RawLibraryPrefix::WriteTo(SnapshotWriter* writer,
|
|
|
| // Write out all the object pointer fields.
|
| SnapshotWriterVisitor visitor(writer, kAsReference);
|
| - visitor.VisitPointers(from(), to());
|
| + RawObject** toobj = writer->snapshot_code() ? to_precompiled_snapshot()
|
| + : to();
|
| + visitor.VisitPointers(from(), toobj);
|
| }
|
|
|
|
|
| @@ -2003,6 +2016,9 @@ RawICData* ICData::ReadFrom(SnapshotReader* reader,
|
| READ_OBJECT_FIELDS(result,
|
| result.raw()->from(), toobj,
|
| kAsReference);
|
| + if (reader->snapshot_code()) {
|
| + result.set_owner(Function::Handle(reader->zone()));
|
| + }
|
|
|
| return result.raw();
|
| }
|
|
|