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
|
|
|
|
2011-05-23 12:59:02 +00:00
|
|
|
class Snapshot {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
2014-06-23 13:52:17 +00:00
|
|
|
// Initialize the VM from the internal snapshot. Returns false if no snapshot
|
2008-07-03 15:10:15 +00:00
|
|
|
// could be found.
|
2014-06-23 13:52:17 +00:00
|
|
|
static bool Initialize();
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-06-19 18:38:03 +00:00
|
|
|
static bool HaveASnapshotToStartFrom();
|
|
|
|
|
2010-03-23 11:40:38 +00:00
|
|
|
// Create a new context using the internal partial snapshot.
|
2013-09-03 11:54:08 +00:00
|
|
|
static Handle<Context> NewContextFromSnapshot(Isolate* isolate);
|
2010-03-23 11:40:38 +00:00
|
|
|
|
2014-06-23 13:52:17 +00:00
|
|
|
// These methods support COMPRESS_STARTUP_DATA_BZ2.
|
2011-04-29 12:08:33 +00:00
|
|
|
static const byte* data() { return data_; }
|
|
|
|
static int size() { return size_; }
|
|
|
|
static int raw_size() { return raw_size_; }
|
|
|
|
static void set_raw_data(const byte* raw_data) {
|
|
|
|
raw_data_ = raw_data;
|
|
|
|
}
|
|
|
|
static const byte* context_data() { return context_data_; }
|
|
|
|
static int context_size() { return context_size_; }
|
|
|
|
static int context_raw_size() { return context_raw_size_; }
|
|
|
|
static void set_context_raw_data(
|
|
|
|
const byte* context_raw_data) {
|
|
|
|
context_raw_data_ = context_raw_data;
|
|
|
|
}
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
2009-01-26 10:21:09 +00:00
|
|
|
static const byte data_[];
|
2011-04-29 12:08:33 +00:00
|
|
|
static const byte* raw_data_;
|
2010-03-23 11:40:38 +00:00
|
|
|
static const byte context_data_[];
|
2011-04-29 12:08:33 +00:00
|
|
|
static const byte* context_raw_data_;
|
2010-03-23 11:40:38 +00:00
|
|
|
static const int new_space_used_;
|
|
|
|
static const int pointer_space_used_;
|
|
|
|
static const int data_space_used_;
|
|
|
|
static const int code_space_used_;
|
|
|
|
static const int map_space_used_;
|
|
|
|
static const int cell_space_used_;
|
2013-06-12 15:03:44 +00:00
|
|
|
static const int property_cell_space_used_;
|
2012-09-14 11:16:56 +00:00
|
|
|
static const int context_new_space_used_;
|
|
|
|
static const int context_pointer_space_used_;
|
|
|
|
static const int context_data_space_used_;
|
|
|
|
static const int context_code_space_used_;
|
|
|
|
static const int context_map_space_used_;
|
|
|
|
static const int context_cell_space_used_;
|
2013-06-12 15:03:44 +00:00
|
|
|
static const int context_property_cell_space_used_;
|
2010-03-23 11:40:38 +00:00
|
|
|
static const int size_;
|
2011-04-29 12:08:33 +00:00
|
|
|
static const int raw_size_;
|
2010-03-23 11:40:38 +00:00
|
|
|
static const int context_size_;
|
2011-04-29 12:08:33 +00:00
|
|
|
static const int context_raw_size_;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-09-14 11:16:56 +00:00
|
|
|
static void ReserveSpaceForLinkedInSnapshot(Deserializer* deserializer);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
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_
|