Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 1584443002: VM: Precompiled rodata snapshot. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: win32, android build Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/raw_object_snapshot.cc
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 87305bab2a32865adaf025b431415dc28f8b3651..c48b9cd6a3aa508ff1c7ed2ccfb146d474948166 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -1345,7 +1345,11 @@ RawInstructions* Instructions::ReadFrom(SnapshotReader* reader,
ASSERT(reader->snapshot_code());
ASSERT(kind == Snapshot::kFull);
+#ifdef DEBUG
intptr_t full_tags = static_cast<uword>(reader->Read<intptr_t>());
+#else
+ intptr_t full_tags = 0; // unused in release mode
+#endif
intptr_t offset = reader->Read<int32_t>();
Instructions& result =
Instructions::ZoneHandle(reader->zone(),
@@ -1367,6 +1371,7 @@ void RawInstructions::WriteTo(SnapshotWriter* writer,
writer->WriteVMIsolateObject(kInstructionsCid);
writer->WriteTags(writer->GetObjectTags(this));
+#ifdef DEBUG
// Instructions will be written pre-marked and in the VM heap. Write out
// the tags we expect to find when reading the snapshot for a sanity check
// that our offsets/alignment didn't get out of sync.
@@ -1374,6 +1379,7 @@ void RawInstructions::WriteTo(SnapshotWriter* writer,
written_tags = RawObject::VMHeapObjectTag::update(true, written_tags);
written_tags = RawObject::MarkBit::update(true, written_tags);
writer->Write<intptr_t>(written_tags);
+#endif
writer->Write<int32_t>(writer->GetInstructionsId(this));
}
@@ -1511,19 +1517,11 @@ RawPcDescriptors* PcDescriptors::ReadFrom(SnapshotReader* reader,
ASSERT(reader->snapshot_code());
ASSERT(kind == Snapshot::kFull);
- const int32_t length = reader->Read<int32_t>();
- PcDescriptors& result =
- PcDescriptors::ZoneHandle(reader->zone(),
- NEW_OBJECT_WITH_LEN(PcDescriptors, length));
+ intptr_t offset = reader->Read<int32_t>();
+ PcDescriptors& result = PcDescriptors::ZoneHandle(reader->zone());
+ result ^= reader->GetObjectAt(offset);
reader->AddBackRef(object_id, &result, kIsDeserialized);
- if (result.Length() > 0) {
- NoSafepointScope no_safepoint;
- intptr_t len = result.Length();
- uint8_t* data = result.UnsafeMutableNonPointer(result.raw_ptr()->data());
- reader->ReadBytes(data, len);
- }
-
return result.raw();
}
@@ -1539,12 +1537,8 @@ void RawPcDescriptors::WriteTo(SnapshotWriter* writer,
writer->WriteInlinedObjectHeader(object_id);
writer->WriteIndexedObject(kPcDescriptorsCid);
writer->WriteTags(writer->GetObjectTags(this));
- writer->Write<int32_t>(ptr()->length_);
- if (ptr()->length_ > 0) {
- intptr_t len = ptr()->length_;
- uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data());
- writer->WriteBytes(data, len);
- }
+
+ writer->Write<int32_t>(writer->GetObjectId(this));
}
@@ -1556,22 +1550,11 @@ RawStackmap* Stackmap::ReadFrom(SnapshotReader* reader,
ASSERT(reader->snapshot_code());
ASSERT(kind == Snapshot::kFull);
- const int32_t length = reader->Read<int32_t>();
- Stackmap& result =
- Stackmap::ZoneHandle(reader->zone(),
- reader->NewStackmap(length));
+ intptr_t offset = reader->Read<int32_t>();
+ Stackmap& result = Stackmap::ZoneHandle(reader->zone());
+ result ^= reader->GetObjectAt(offset);
reader->AddBackRef(object_id, &result, kIsDeserialized);
- result.SetRegisterBitCount(reader->Read<int32_t>());
- result.SetPcOffset(reader->Read<uint32_t>());
-
- if (length > 0) {
- NoSafepointScope no_safepoint;
- intptr_t len = (result.Length() + 7) / 8;
- uint8_t* data = result.UnsafeMutableNonPointer(result.raw_ptr()->data());
- reader->ReadBytes(data, len);
- }
-
return result.raw();
}
@@ -1588,14 +1571,7 @@ void RawStackmap::WriteTo(SnapshotWriter* writer,
writer->WriteIndexedObject(kStackmapCid);
writer->WriteTags(writer->GetObjectTags(this));
- writer->Write<int32_t>(ptr()->length_);
- writer->Write<int32_t>(ptr()->register_bit_count_);
- writer->Write<uint32_t>(ptr()->pc_offset_);
- if (ptr()->length_ > 0) {
- intptr_t len = (ptr()->length_ + 7) / 8;
- uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data());
- writer->WriteBytes(data, len);
- }
+ writer->Write<int32_t>(writer->GetObjectId(this));
}
« runtime/vm/pages.cc ('K') | « runtime/vm/raw_object.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698