5 #include "src/snapshot/read-only-deserializer.h" 8 #include "src/heap/heap-inl.h" 9 #include "src/objects/slots.h" 10 #include "src/snapshot/snapshot.h" 11 #include "src/v8threads.h" 16 void ReadOnlyDeserializer::DeserializeInto(Isolate* isolate) {
19 if (!allocator()->ReserveSpace()) {
20 V8::FatalProcessOutOfMemory(isolate,
"ReadOnlyDeserializer");
24 DCHECK_NULL(isolate->thread_manager()->FirstThreadStateInUse());
26 DCHECK(isolate->handle_scope_implementer()->blocks()->empty());
28 DCHECK(isolate->read_only_object_cache()->empty());
29 DCHECK(isolate->partial_snapshot_cache()->empty());
31 DCHECK(!isolate->builtins()->is_initialized());
34 DisallowHeapAllocation no_gc;
36 ReadOnlyRoots(isolate).Iterate(
this);
37 isolate->heap()->read_only_space()->RepairFreeListsAfterDeserialization();
40 std::vector<Object*>* cache = isolate->read_only_object_cache();
41 for (
size_t i = 0;; ++
i) {
43 if (cache->size() <=
i) cache->push_back(Smi::kZero);
46 VisitRootPointer(Root::kReadOnlyObjectCache,
nullptr,
47 ObjectSlot(&cache->at(
i)));
48 if (cache->at(
i)->IsUndefined(isolate))
break;
50 DeserializeDeferredObjects();
54 void ReadOnlyDeserializer::RehashHeap() {
55 DCHECK(FLAG_rehash_snapshot && can_rehash());