%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/snapshot/serializer-deserializer.h" #include "src/objects/foreign-inl.h" #include "src/objects/objects-inl.h" namespace v8 { namespace internal { // The startup object cache is terminated by undefined. We visit the context // snapshot... // - during deserialization to populate it. // - during normal GC to keep its content alive. // - not during serialization. The context serializer adds to it explicitly. DISABLE_CFI_PERF void SerializerDeserializer::Iterate(Isolate* isolate, RootVisitor* visitor) { std::vector<Object>* cache = isolate->startup_object_cache(); for (size_t i = 0;; ++i) { // Extend the array ready to get a value when deserializing. if (cache->size() <= i) cache->push_back(Smi::zero()); // During deserialization, the visitor populates the startup object cache // and eventually terminates the cache with undefined. visitor->VisitRootPointer(Root::kStartupObjectCache, nullptr, FullObjectSlot(&cache->at(i))); if (cache->at(i).IsUndefined(isolate)) break; } } bool SerializerDeserializer::CanBeDeferred(HeapObject o) { // 1. Maps cannot be deferred as objects are expected to have a valid map // immediately. // 2. Internalized strings cannot be deferred as they might be // converted to thin strings during post processing, at which point forward // references to the now-thin string will already have been written. // 3. JS objects with embedder fields cannot be deferred because the // serialize/deserialize callbacks need the back reference immediately to // identify the object. // TODO(leszeks): Could we defer string serialization if forward references // were resolved after object post processing? return !o.IsMap() && !o.IsInternalizedString() && !(o.IsJSObject() && JSObject::cast(o).GetEmbedderFieldCount() > 0); } void SerializerDeserializer::RestoreExternalReferenceRedirector( Isolate* isolate, Handle<AccessorInfo> accessor_info) { // Restore wiped accessor infos. Foreign::cast(accessor_info->js_getter()) .set_foreign_address(isolate, accessor_info->redirected_getter()); } void SerializerDeserializer::RestoreExternalReferenceRedirector( Isolate* isolate, Handle<CallHandlerInfo> call_handler_info) { Foreign::cast(call_handler_info->js_callback()) .set_foreign_address(isolate, call_handler_info->redirected_callback()); } } // namespace internal } // namespace v8