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

Side by Side Diff: src/snapshot/startup-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 unified diff | Download patch
« no previous file with comments | « src/snapshot/startup-serializer.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/snapshot/startup-serializer.h" 5 #include "src/snapshot/startup-serializer.h"
6 6
7 #include "src/objects-inl.h" 7 #include "src/objects-inl.h"
8 #include "src/v8threads.h" 8 #include "src/v8threads.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // This comes right after serialization of the partial snapshot, where we 83 // This comes right after serialization of the partial snapshot, where we
84 // add entries to the partial snapshot cache of the startup snapshot. Add 84 // add entries to the partial snapshot cache of the startup snapshot. Add
85 // one entry with 'undefined' to terminate the partial snapshot cache. 85 // one entry with 'undefined' to terminate the partial snapshot cache.
86 Object* undefined = isolate()->heap()->undefined_value(); 86 Object* undefined = isolate()->heap()->undefined_value();
87 VisitPointer(&undefined); 87 VisitPointer(&undefined);
88 isolate()->heap()->IterateWeakRoots(this, VISIT_ALL); 88 isolate()->heap()->IterateWeakRoots(this, VISIT_ALL);
89 SerializeDeferredObjects(); 89 SerializeDeferredObjects();
90 Pad(); 90 Pad();
91 } 91 }
92 92
93 int StartupSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) {
94 int index;
95 if (!partial_cache_index_map_.LookupOrInsert(heap_object, &index)) {
96 // This object is not part of the partial snapshot cache yet. Add it to the
97 // startup snapshot so we can refer to it via partial snapshot index from
98 // the partial snapshot.
99 VisitPointer(reinterpret_cast<Object**>(&heap_object));
100 }
101 return index;
102 }
103
93 void StartupSerializer::Synchronize(VisitorSynchronization::SyncTag tag) { 104 void StartupSerializer::Synchronize(VisitorSynchronization::SyncTag tag) {
94 // We expect the builtins tag after builtins have been serialized. 105 // We expect the builtins tag after builtins have been serialized.
95 DCHECK(!serializing_builtins_ || tag == VisitorSynchronization::kBuiltins); 106 DCHECK(!serializing_builtins_ || tag == VisitorSynchronization::kBuiltins);
96 serializing_builtins_ = (tag == VisitorSynchronization::kHandleScope); 107 serializing_builtins_ = (tag == VisitorSynchronization::kHandleScope);
97 sink_.Put(kSynchronize, "Synchronize"); 108 sink_.Put(kSynchronize, "Synchronize");
98 } 109 }
99 110
100 void StartupSerializer::SerializeStrongReferences() { 111 void StartupSerializer::SerializeStrongReferences() {
101 Isolate* isolate = this->isolate(); 112 Isolate* isolate = this->isolate();
102 // No active threads. 113 // No active threads.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if (root_index == Heap::kStackLimitRootIndex || 170 if (root_index == Heap::kStackLimitRootIndex ||
160 root_index == Heap::kRealStackLimitRootIndex) { 171 root_index == Heap::kRealStackLimitRootIndex) {
161 return true; 172 return true;
162 } 173 }
163 return Heap::RootIsImmortalImmovable(root_index) != 174 return Heap::RootIsImmortalImmovable(root_index) !=
164 serializing_immortal_immovables_roots_; 175 serializing_immortal_immovables_roots_;
165 } 176 }
166 177
167 } // namespace internal 178 } // namespace internal
168 } // namespace v8 179 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/startup-serializer.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698