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

Side by Side Diff: src/snapshot/deserializer.cc

Issue 2840493002: [snapshot] full setup delegate should also be able to deserialize. (Closed)
Patch Set: fix comment Created 3 years, 7 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/setup-isolate-full.cc ('k') | src/snapshot/snapshot.h » ('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/deserializer.h" 5 #include "src/snapshot/deserializer.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/assembler-inl.h" 8 #include "src/assembler-inl.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 void Deserializer::Deserialize(Isolate* isolate) { 86 void Deserializer::Deserialize(Isolate* isolate) {
87 Initialize(isolate); 87 Initialize(isolate);
88 if (!ReserveSpace()) V8::FatalProcessOutOfMemory("deserializing context"); 88 if (!ReserveSpace()) V8::FatalProcessOutOfMemory("deserializing context");
89 // No active threads. 89 // No active threads.
90 DCHECK_NULL(isolate_->thread_manager()->FirstThreadStateInUse()); 90 DCHECK_NULL(isolate_->thread_manager()->FirstThreadStateInUse());
91 // No active handles. 91 // No active handles.
92 DCHECK(isolate_->handle_scope_implementer()->blocks()->is_empty()); 92 DCHECK(isolate_->handle_scope_implementer()->blocks()->is_empty());
93 // Partial snapshot cache is not yet populated. 93 // Partial snapshot cache is not yet populated.
94 DCHECK(isolate_->partial_snapshot_cache()->is_empty()); 94 DCHECK(isolate_->partial_snapshot_cache()->is_empty());
95 // Builtins are not yet created.
96 DCHECK(!isolate_->builtins()->is_initialized());
95 97
96 { 98 {
97 DisallowHeapAllocation no_gc; 99 DisallowHeapAllocation no_gc;
98 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG_ROOT_LIST); 100 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG_ROOT_LIST);
99 isolate_->heap()->IterateSmiRoots(this); 101 isolate_->heap()->IterateSmiRoots(this);
100 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); 102 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG);
101 isolate_->heap()->RepairFreeListsAfterDeserialization(); 103 isolate_->heap()->RepairFreeListsAfterDeserialization();
102 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL); 104 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL);
103 DeserializeDeferredObjects(); 105 DeserializeDeferredObjects();
104 FlushICacheForNewIsolate(); 106 FlushICacheForNewIsolate();
105 RestoreExternalReferenceRedirectors(&accessor_infos_); 107 RestoreExternalReferenceRedirectors(&accessor_infos_);
106 } 108 }
107 109
108 isolate_->heap()->set_native_contexts_list( 110 isolate_->heap()->set_native_contexts_list(
109 isolate_->heap()->undefined_value()); 111 isolate_->heap()->undefined_value());
110 // The allocation site list is build during root iteration, but if no sites 112 // The allocation site list is build during root iteration, but if no sites
111 // were encountered then it needs to be initialized to undefined. 113 // were encountered then it needs to be initialized to undefined.
112 if (isolate_->heap()->allocation_sites_list() == Smi::kZero) { 114 if (isolate_->heap()->allocation_sites_list() == Smi::kZero) {
113 isolate_->heap()->set_allocation_sites_list( 115 isolate_->heap()->set_allocation_sites_list(
114 isolate_->heap()->undefined_value()); 116 isolate_->heap()->undefined_value());
115 } 117 }
116 118
117 // If needed, print the dissassembly of deserialized code objects. 119 // If needed, print the dissassembly of deserialized code objects.
118 PrintDisassembledCodeObjects(); 120 PrintDisassembledCodeObjects();
119 121
120 // Issue code events for newly deserialized code objects. 122 // Issue code events for newly deserialized code objects.
121 LOG_CODE_EVENT(isolate_, LogCodeObjects()); 123 LOG_CODE_EVENT(isolate_, LogCodeObjects());
122 LOG_CODE_EVENT(isolate_, LogBytecodeHandlers()); 124 LOG_CODE_EVENT(isolate_, LogBytecodeHandlers());
123 LOG_CODE_EVENT(isolate_, LogCompiledFunctions()); 125 LOG_CODE_EVENT(isolate_, LogCompiledFunctions());
126
127 isolate_->builtins()->MarkInitialized();
124 } 128 }
125 129
126 MaybeHandle<Object> Deserializer::DeserializePartial( 130 MaybeHandle<Object> Deserializer::DeserializePartial(
127 Isolate* isolate, Handle<JSGlobalProxy> global_proxy, 131 Isolate* isolate, Handle<JSGlobalProxy> global_proxy,
128 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer) { 132 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer) {
129 Initialize(isolate); 133 Initialize(isolate);
130 if (!ReserveSpace()) { 134 if (!ReserveSpace()) {
131 V8::FatalProcessOutOfMemory("deserialize context"); 135 V8::FatalProcessOutOfMemory("deserialize context");
132 return MaybeHandle<Object>(); 136 return MaybeHandle<Object>();
133 } 137 }
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 910
907 default: 911 default:
908 CHECK(false); 912 CHECK(false);
909 } 913 }
910 } 914 }
911 CHECK_EQ(limit, current); 915 CHECK_EQ(limit, current);
912 return true; 916 return true;
913 } 917 }
914 } // namespace internal 918 } // namespace internal
915 } // namespace v8 919 } // namespace v8
OLDNEW
« no previous file with comments | « src/setup-isolate-full.cc ('k') | src/snapshot/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698