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

Unified Diff: src/snapshot/partial-serializer.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.h ('k') | src/snapshot/serializer-common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/partial-serializer.cc
diff --git a/src/snapshot/partial-serializer.cc b/src/snapshot/partial-serializer.cc
index bfbbcf8a70edf3d9bfd95934de9b182e865e3952..0f1f133edc0b1707658bb6de70bde0a50726fc6d 100644
--- a/src/snapshot/partial-serializer.cc
+++ b/src/snapshot/partial-serializer.cc
@@ -14,7 +14,8 @@ PartialSerializer::PartialSerializer(Isolate* isolate,
SnapshotByteSink* sink)
: Serializer(isolate, sink),
startup_serializer_(startup_snapshot_serializer),
- global_object_(NULL) {
+ global_object_(NULL),
+ next_partial_cache_index_(0) {
InitializeCodeAddressMap();
}
@@ -94,20 +95,14 @@ void PartialSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
}
int PartialSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) {
- Isolate* isolate = this->isolate();
- List<Object*>* cache = isolate->partial_snapshot_cache();
- int new_index = cache->length();
-
- int index = partial_cache_index_map_.LookupOrInsert(heap_object, new_index);
+ int index = partial_cache_index_map_.LookupOrInsert(
+ heap_object, next_partial_cache_index_);
if (index == PartialCacheIndexMap::kInvalidIndex) {
- // We didn't find the object in the cache. So we add it to the cache and
- // then visit the pointer so that it becomes part of the startup snapshot
- // and we can refer to it from the partial snapshot.
- cache->Add(heap_object);
+ // This object is not part of the partial snapshot cache yet. Add it to the
+ // startup snapshot so we can refer to it via partial snapshot index from
+ // the partial snapshot.
startup_serializer_->VisitPointer(reinterpret_cast<Object**>(&heap_object));
- // We don't recurse from the startup snapshot generator into the partial
- // snapshot generator.
- return new_index;
+ return next_partial_cache_index_++;
}
return index;
}
« no previous file with comments | « src/snapshot/partial-serializer.h ('k') | src/snapshot/serializer-common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698