1 // Copyright 2017 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_SNAPSHOT_OBJECT_DESERIALIZER_H_ 6 #define V8_SNAPSHOT_OBJECT_DESERIALIZER_H_ 7 8 #include "src/snapshot/deserializer.h" 9 10 namespace v8 { 11 namespace internal { 12 13 class SerializedCodeData; 14 class SharedFunctionInfo; 15 16 // Deserializes the object graph rooted at a given object. 17 class ObjectDeserializer final : public Deserializer<Isolate> { 18 public: 19 static MaybeHandle<SharedFunctionInfo> DeserializeSharedFunctionInfo( 20 Isolate* isolate, const SerializedCodeData* data, Handle<String> source); 21 22 private: 23 explicit ObjectDeserializer(Isolate* isolate, const SerializedCodeData* data); 24 25 // Deserialize an object graph. Fail gracefully. 26 MaybeHandle<HeapObject> Deserialize(); 27 28 void LinkAllocationSites(); 29 void CommitPostProcessedObjects(); 30 }; 31 32 // Deserializes the object graph rooted at a given object. 33 class OffThreadObjectDeserializer final : public Deserializer<LocalIsolate> { 34 public: 35 static MaybeHandle<SharedFunctionInfo> DeserializeSharedFunctionInfo( 36 LocalIsolate* isolate, const SerializedCodeData* data, 37 std::vector<Handle<Script>>* deserialized_scripts); 38 39 private: 40 explicit OffThreadObjectDeserializer(LocalIsolate* isolate, 41 const SerializedCodeData* data); 42 43 // Deserialize an object graph. Fail gracefully. 44 MaybeHandle<HeapObject> Deserialize( 45 std::vector<Handle<Script>>* deserialized_scripts); 46 }; 47 48 } // namespace internal 49 } // namespace v8 50 51 #endif // V8_SNAPSHOT_OBJECT_DESERIALIZER_H_ 52