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_STARTUP_DESERIALIZER_H_ 6 #define V8_SNAPSHOT_STARTUP_DESERIALIZER_H_ 7 8 #include "src/snapshot/deserializer.h" 9 #include "src/snapshot/snapshot-data.h" 10 #include "src/snapshot/snapshot.h" 11 12 namespace v8 { 13 namespace internal { 14 15 // Initializes an isolate with context-independent data from a given snapshot. 16 class StartupDeserializer final : public Deserializer<Isolate> { 17 public: StartupDeserializer(Isolate * isolate,const SnapshotData * startup_data,bool can_rehash)18 explicit StartupDeserializer(Isolate* isolate, 19 const SnapshotData* startup_data, 20 bool can_rehash) 21 : Deserializer(isolate, startup_data->Payload(), 22 startup_data->GetMagicNumber(), false, can_rehash) {} 23 24 // Deserialize the snapshot into an empty heap. 25 void DeserializeIntoIsolate(); 26 27 private: 28 void FlushICache(); 29 void LogNewMapEvents(); 30 }; 31 32 } // namespace internal 33 } // namespace v8 34 35 #endif // V8_SNAPSHOT_STARTUP_DESERIALIZER_H_ 36