5 #include "src/snapshot/startup-deserializer.h" 8 #include "src/assembler-inl.h" 9 #include "src/code-stubs.h" 10 #include "src/heap/heap-inl.h" 11 #include "src/snapshot/read-only-deserializer.h" 12 #include "src/snapshot/snapshot.h" 17 void StartupDeserializer::DeserializeInto(Isolate* isolate) {
20 ReadOnlyDeserializer read_only_deserializer(read_only_data_);
21 read_only_deserializer.SetRehashability(can_rehash());
22 read_only_deserializer.DeserializeInto(isolate);
24 if (!allocator()->ReserveSpace()) {
25 V8::FatalProcessOutOfMemory(isolate,
"StartupDeserializer");
29 DCHECK_NULL(isolate->thread_manager()->FirstThreadStateInUse());
31 DCHECK(isolate->handle_scope_implementer()->blocks()->empty());
33 DCHECK(isolate->partial_snapshot_cache()->empty());
35 DCHECK(!isolate->builtins()->is_initialized());
38 DisallowHeapAllocation no_gc;
39 isolate->heap()->IterateSmiRoots(
this);
40 isolate->heap()->IterateStrongRoots(
this, VISIT_FOR_SERIALIZATION);
41 Iterate(isolate,
this);
42 isolate->heap()->IterateWeakRoots(
this, VISIT_FOR_SERIALIZATION);
43 DeserializeDeferredObjects();
44 RestoreExternalReferenceRedirectors(accessor_infos());
45 RestoreExternalReferenceRedirectors(call_handler_infos());
52 isolate->heap()->set_native_contexts_list(
53 ReadOnlyRoots(isolate).undefined_value());
56 if (isolate->heap()->allocation_sites_list() == Smi::kZero) {
57 isolate->heap()->set_allocation_sites_list(
58 ReadOnlyRoots(isolate).undefined_value());
62 isolate->builtins()->MarkInitialized();
66 if (FLAG_rehash_snapshot && can_rehash()) {
67 isolate->heap()->InitializeHashSeed();
68 read_only_deserializer.RehashHeap();
73 void StartupDeserializer::LogNewMapEvents() {
74 if (FLAG_trace_maps) LOG(isolate_, LogAllMaps());
77 void StartupDeserializer::FlushICache() {
78 DCHECK(!deserializing_user_code());
80 for (Page* p : *isolate()->heap()->code_space()) {
81 Assembler::FlushICache(p->area_start(), p->area_end() - p->area_start());