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

Unified Diff: src/snapshot/serialize.cc

Issue 1675553002: [serializer] Ensure immortal immovable roots are deserialized correctly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 10 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
« no previous file with comments | « src/address-map.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/serialize.cc
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc
index 6ebcd9d9d5ee2766fb21b3788e347cd3cc2f178b..47d4c9fafeac94eeaef3580fdaf4ab91683caa6b 100644
--- a/src/snapshot/serialize.cc
+++ b/src/snapshot/serialize.cc
@@ -1717,12 +1717,16 @@ void StartupSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
}
int root_index = root_index_map_.Lookup(obj);
+ bool is_immortal_immovable_root = false;
// We can only encode roots as such if it has already been serialized.
// That applies to root indices below the wave front.
- if (root_index != RootIndexMap::kInvalidRootIndex &&
- root_index < root_index_wave_front_) {
- PutRoot(root_index, obj, how_to_code, where_to_point, skip);
- return;
+ if (root_index != RootIndexMap::kInvalidRootIndex) {
+ if (root_index < root_index_wave_front_) {
+ PutRoot(root_index, obj, how_to_code, where_to_point, skip);
+ return;
+ } else {
+ is_immortal_immovable_root = Heap::RootIsImmortalImmovable(root_index);
+ }
}
if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return;
@@ -1733,6 +1737,14 @@ void StartupSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
ObjectSerializer object_serializer(this, obj, sink_, how_to_code,
where_to_point);
object_serializer.Serialize();
+
+ if (is_immortal_immovable_root) {
+ // Make sure that the immortal immovable root has been included in the first
+ // chunk of its reserved space , so that it is deserialized onto the first
+ // page of its space and stays immortal immovable.
+ BackReference ref = back_reference_map_.Lookup(obj);
+ CHECK(ref.is_valid() && ref.chunk_index() == 0);
+ }
}
« no previous file with comments | « src/address-map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698