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

Unified Diff: src/snapshot/serializer-common.cc

Issue 1805903002: [serializer] Add API to warm up startup snapshot with an additional script. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix comment 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
« no previous file with comments | « src/snapshot/partial-serializer.cc ('k') | src/snapshot/startup-serializer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/serializer-common.cc
diff --git a/src/snapshot/serializer-common.cc b/src/snapshot/serializer-common.cc
index e92994b6c8887afeb1453a72ccbfa07c8261dc8a..e7178a7e0c1c7b4bee8b20d02f600c5b2a0976f6 100644
--- a/src/snapshot/serializer-common.cc
+++ b/src/snapshot/serializer-common.cc
@@ -390,23 +390,19 @@ void SerializedData::AllocateData(int size) {
DCHECK(IsAligned(reinterpret_cast<intptr_t>(data_), kPointerAlignment));
}
-// This ensures that the partial snapshot cache keeps things alive during GC and
-// tracks their movement. When it is called during serialization of the startup
-// snapshot nothing happens. When the partial (context) snapshot is created,
-// this array is populated with the pointers that the partial snapshot will
-// need. As that happens we emit serialized objects to the startup snapshot
-// that correspond to the elements of this cache array. On deserialization we
-// therefore need to visit the cache array. This fills it up with pointers to
-// deserialized objects.
+// The partial snapshot cache is terminated by undefined. We visit the
+// partial snapshot...
+// - during deserialization to populate it.
+// - during normal GC to keep its content alive.
+// - not during serialization. The partial serializer adds to it explicitly.
void SerializerDeserializer::Iterate(Isolate* isolate, ObjectVisitor* visitor) {
- if (isolate->serializer_enabled()) return;
List<Object*>* cache = isolate->partial_snapshot_cache();
for (int i = 0;; ++i) {
// Extend the array ready to get a value when deserializing.
if (cache->length() <= i) cache->Add(Smi::FromInt(0));
+ // During deserialization, the visitor populates the partial snapshot cache
+ // and eventually terminates the cache with undefined.
visitor->VisitPointer(&cache->at(i));
- // Sentinel is the undefined object, which is a root so it will not normally
- // be found in the cache.
if (cache->at(i)->IsUndefined()) break;
}
}
« no previous file with comments | « src/snapshot/partial-serializer.cc ('k') | src/snapshot/startup-serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698