2008-09-09 20:08:45 +00:00
|
|
|
// Copyright 2006-2008 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/isolate.h"
|
2011-03-18 20:35:07 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
#ifndef V8_SNAPSHOT_H_
|
|
|
|
#define V8_SNAPSHOT_H_
|
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-12-10 14:20:12 +00:00
|
|
|
class Snapshot : public AllStatic {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
2014-09-19 08:01:35 +00:00
|
|
|
// Initialize the Isolate from the internal snapshot. Returns false if no
|
|
|
|
// snapshot could be found.
|
|
|
|
static bool Initialize(Isolate* isolate);
|
2014-12-10 11:46:27 +00:00
|
|
|
// Create a new context using the internal partial snapshot.
|
2015-01-13 08:48:00 +00:00
|
|
|
static MaybeHandle<Context> NewContextFromSnapshot(
|
|
|
|
Isolate* isolate, Handle<FixedArray>* outdated_contexts_out);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-06-19 18:38:03 +00:00
|
|
|
static bool HaveASnapshotToStartFrom();
|
|
|
|
|
2014-12-10 14:20:12 +00:00
|
|
|
// To be implemented by the snapshot source.
|
2014-12-10 11:46:27 +00:00
|
|
|
static const v8::StartupData SnapshotBlob();
|
2010-03-23 11:40:38 +00:00
|
|
|
|
2014-12-10 14:20:12 +00:00
|
|
|
static v8::StartupData CreateSnapshotBlob(
|
|
|
|
const Vector<const byte> startup_data,
|
|
|
|
const Vector<const byte> context_data);
|
|
|
|
|
|
|
|
static Vector<const byte> ExtractStartupData(const v8::StartupData* data);
|
|
|
|
static Vector<const byte> ExtractContextData(const v8::StartupData* data);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Snapshot);
|
|
|
|
};
|
|
|
|
|
2014-06-23 13:52:17 +00:00
|
|
|
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
|
|
|
void SetSnapshotFromFile(StartupData* snapshot_blob);
|
|
|
|
#endif
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_SNAPSHOT_H_
|