v8/src/snapshot.h
vogelheim@chromium.org 7b7bb25a24 Support external startup data in V8.
[Re-retry of r21696 and r21739]

If the embedder chooses, the 'natives' (library sources) and the
precompiled startup blob can be written to files during the build
process and handed over to V8 at startup. The main purpose would be
to reduce the size of the compiled binary for space constrained
platforms.

The build-time option is off by default. Nothing should change if
it's not enabled.

BUG=
R=jochen@chromium.org

Review URL: https://codereview.chromium.org/334913004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21941 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-06-23 13:52:17 +00:00

75 lines
2.3 KiB
C++

// Copyright 2006-2008 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/isolate.h"
#ifndef V8_SNAPSHOT_H_
#define V8_SNAPSHOT_H_
namespace v8 {
namespace internal {
class Snapshot {
public:
// Initialize the VM from the internal snapshot. Returns false if no snapshot
// could be found.
static bool Initialize();
static bool HaveASnapshotToStartFrom();
// Create a new context using the internal partial snapshot.
static Handle<Context> NewContextFromSnapshot(Isolate* isolate);
// These methods support COMPRESS_STARTUP_DATA_BZ2.
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;
}
private:
static const byte data_[];
static const byte* raw_data_;
static const byte context_data_[];
static const byte* context_raw_data_;
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_;
static const int property_cell_space_used_;
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_;
static const int context_property_cell_space_used_;
static const int size_;
static const int raw_size_;
static const int context_size_;
static const int context_raw_size_;
static void ReserveSpaceForLinkedInSnapshot(Deserializer* deserializer);
DISALLOW_IMPLICIT_CONSTRUCTORS(Snapshot);
};
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
void SetSnapshotFromFile(StartupData* snapshot_blob);
#endif
} } // namespace v8::internal
#endif // V8_SNAPSHOT_H_