v8/src/snapshot-external.cc
2015-01-14 11:06:51 +00:00

36 lines
1005 B
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.
// Used for building with external snapshots.
#include "src/snapshot.h"
#include "src/serialize.h"
#include "src/snapshot-source-sink.h"
#include "src/v8.h" // for V8::Initialize
#ifndef V8_USE_EXTERNAL_STARTUP_DATA
#error snapshot-external.cc is used only for the external snapshot build.
#endif // V8_USE_EXTERNAL_STARTUP_DATA
namespace v8 {
namespace internal {
static v8::StartupData external_startup_blob = {NULL, 0};
void SetSnapshotFromFile(StartupData* snapshot_blob) {
DCHECK(snapshot_blob);
DCHECK(snapshot_blob->data);
DCHECK(snapshot_blob->raw_size > 0);
DCHECK(!external_startup_blob.data);
DCHECK(Snapshot::SnapshotIsValid(snapshot_blob));
external_startup_blob = *snapshot_blob;
}
const v8::StartupData Snapshot::SnapshotBlob() { return external_startup_blob; }
} } // namespace v8::internal