| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index e6833530041b9794dbd0c63f34e5c6e26d33d0e9..203da5cc901cfd99d99d45a2d1966f9b6eecc550 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -311,6 +311,64 @@ static inline i::Isolate* EnterIsolateIfNeeded() {
|
| }
|
|
|
|
|
| +enum CompressedStartupDataItems {
|
| + kSnapshot = 0,
|
| + kSnapshotContext,
|
| + kCompressedStartupDataCount
|
| +};
|
| +
|
| +int V8::GetCompressedStartupDataCount() {
|
| +#ifdef COMPRESS_STARTUP_DATA_BZ2
|
| + return kCompressedStartupDataCount;
|
| +#else
|
| + return 0;
|
| +#endif
|
| +}
|
| +
|
| +
|
| +void V8::GetCompressedStartupData(StartupData* compressed_data) {
|
| +#ifdef COMPRESS_STARTUP_DATA_BZ2
|
| + compressed_data->id = kSnapshot;
|
| + compressed_data->data = reinterpret_cast<const char*>(i::Snapshot::data());
|
| + compressed_data->compressed_size = i::Snapshot::size();
|
| + compressed_data->decompressed_size = i::Snapshot::decompressed_size();
|
| +
|
| + ++compressed_data;
|
| + compressed_data->id = kSnapshotContext;
|
| + compressed_data->data =
|
| + reinterpret_cast<const char*>(i::Snapshot::context_data());
|
| + compressed_data->compressed_size = i::Snapshot::context_size();
|
| + compressed_data->decompressed_size = i::Snapshot::context_decompressed_size();
|
| +#endif
|
| +}
|
| +
|
| +
|
| +void V8::SetDecompressedStartupData(StartupData* decompressed_data) {
|
| +#ifdef COMPRESS_STARTUP_DATA_BZ2
|
| + for (int i = 0;
|
| + i < GetCompressedStartupDataCount();
|
| + ++i, ++decompressed_data) {
|
| + switch (decompressed_data->id) {
|
| + case kSnapshot:
|
| + ASSERT(i::Snapshot::decompressed_size() ==
|
| + decompressed_data->decompressed_size);
|
| + i::Snapshot::set_decompressed_data(
|
| + reinterpret_cast<const i::byte*>(decompressed_data->data));
|
| + break;
|
| + case kSnapshotContext:
|
| + ASSERT(i::Snapshot::context_decompressed_size() ==
|
| + decompressed_data->decompressed_size);
|
| + i::Snapshot::set_context_decompressed_data(
|
| + reinterpret_cast<const i::byte*>(decompressed_data->data));
|
| + break;
|
| + default:
|
| + UNREACHABLE();
|
| + }
|
| + }
|
| +#endif
|
| +}
|
| +
|
| +
|
| void V8::SetFatalErrorHandler(FatalErrorCallback that) {
|
| i::Isolate* isolate = EnterIsolateIfNeeded();
|
| isolate->set_exception_behavior(that);
|
|
|