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

Unified Diff: src/snapshot/startup-serializer.h

Issue 1811913002: [serializer] ensure that immortal immovable roots are correctly deserialized. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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: src/snapshot/startup-serializer.h
diff --git a/src/snapshot/startup-serializer.h b/src/snapshot/startup-serializer.h
index 1fe22543f474af24c103e74d53ee8b99ffa947a3..71b8475469a7aaafffb8009969daf9f036c38d46 100644
--- a/src/snapshot/startup-serializer.h
+++ b/src/snapshot/startup-serializer.h
@@ -5,6 +5,7 @@
#ifndef V8_SNAPSHOT_STARTUP_SERIALIZER_H_
#define V8_SNAPSHOT_STARTUP_SERIALIZER_H_
+#include <bitset>
#include "src/snapshot/serializer.h"
namespace v8 {
@@ -20,9 +21,10 @@ class StartupSerializer : public Serializer {
~StartupSerializer() override;
// Serialize the current state of the heap. The order is:
- // 1) Strong references.
- // 2) Partial snapshot cache.
- // 3) Weak references (e.g. the string table).
+ // 1) Immortal immovable roots
+ // 2) Remaining strong references.
+ // 3) Partial snapshot cache.
+ // 4) Weak references (e.g. the string table).
void SerializeStrongReferences();
void SerializeWeakReferencesAndDeferred();
@@ -34,9 +36,16 @@ class StartupSerializer : public Serializer {
WhereToPoint where_to_point, int skip) override;
void Synchronize(VisitorSynchronization::SyncTag tag) override;
- intptr_t root_index_wave_front_;
- bool serializing_builtins_;
+ // Some roots should not be serialized, because their actual value depends on
+ // absolute addresses and they are reset after deserialization, anyway.
+ // In the first pass over the root list, we only serialize immortal immovable
+ // roots. In the second pass, we serialize the rest.
+ bool RootShouldBeSkipped(int root_index);
+
FunctionCodeHandling function_code_handling_;
+ bool serializing_builtins_;
+ bool serializing_immortal_immovables_roots_;
+ std::bitset<Heap::kStrongRootListLength> root_has_been_serialized_;
DISALLOW_COPY_AND_ASSIGN(StartupSerializer);
};

Powered by Google App Engine
This is Rietveld 408576698