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

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

Issue 2055203002: [snapshot] support multiple contexts in the same snapshot. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@sinkmember
Patch Set: fix test. again. Created 4 years, 6 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/snapshot.h » ('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 7347995881b7ad14bc58d19875eb5cf123e11b1f..eec49c060e325e06ac9c915ea4fcbb155604924b 100644
--- a/src/snapshot/partial-serializer.cc
+++ b/src/snapshot/partial-serializer.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "src/snapshot/partial-serializer.h"
+#include "src/snapshot/startup-serializer.h"
#include "src/objects-inl.h"
@@ -10,10 +11,8 @@ namespace v8 {
namespace internal {
PartialSerializer::PartialSerializer(Isolate* isolate,
- Serializer* startup_snapshot_serializer)
- : Serializer(isolate),
- startup_serializer_(startup_snapshot_serializer),
- next_partial_cache_index_(0) {
+ StartupSerializer* startup_serializer)
+ : Serializer(isolate), startup_serializer_(startup_serializer) {
InitializeCodeAddressMap();
}
@@ -61,7 +60,7 @@ void PartialSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
if (ShouldBeInThePartialSnapshotCache(obj)) {
FlushSkip(skip);
- int cache_index = PartialSnapshotCacheIndex(obj);
+ int cache_index = startup_serializer_->PartialSnapshotCacheIndex(obj);
sink_.Put(kPartialSnapshotCache + how_to_code + where_to_point,
"PartialSnapshotCache");
sink_.PutInt(cache_index, "partial_snapshot_cache_index");
@@ -93,19 +92,6 @@ void PartialSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
serializer.Serialize();
}
-int PartialSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) {
- int index = partial_cache_index_map_.LookupOrInsert(
- heap_object, next_partial_cache_index_);
- if (index == PartialCacheIndexMap::kInvalidIndex) {
- // 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));
- return next_partial_cache_index_++;
- }
- return index;
-}
-
bool PartialSerializer::ShouldBeInThePartialSnapshotCache(HeapObject* o) {
// Scripts should be referred only through shared function infos. We can't
// allow them to be part of the partial snapshot because they contain a
« no previous file with comments | « src/snapshot/partial-serializer.h ('k') | src/snapshot/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698