Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index e6833530041b9794dbd0c63f34e5c6e26d33d0e9..84c0be46c901a64bad6c9d859057028c84b7e264 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -311,6 +311,61 @@ static inline i::Isolate* EnterIsolateIfNeeded() { |
} |
+StartupData::CompressionAlgorithm V8::GetCompressedStartupDataAlgorithm() { |
+#ifdef COMPRESS_STARTUP_DATA_BZ2 |
+ return StartupData::kBZip2; |
+#else |
+ return StartupData::kUncompressed; |
+#endif |
+} |
+ |
+ |
+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[kSnapshot].data = |
+ reinterpret_cast<const char*>(i::Snapshot::data()); |
+ compressed_data[kSnapshot].compressed_size = i::Snapshot::size(); |
+ compressed_data[kSnapshot].raw_size = i::Snapshot::raw_size(); |
+ |
+ compressed_data[kSnapshotContext].data = |
+ reinterpret_cast<const char*>(i::Snapshot::context_data()); |
+ compressed_data[kSnapshotContext].compressed_size = |
+ i::Snapshot::context_size(); |
+ compressed_data[kSnapshotContext].raw_size = i::Snapshot::context_raw_size(); |
+#endif |
+} |
+ |
+ |
+void V8::SetDecompressedStartupData(StartupData* decompressed_data) { |
+#ifdef COMPRESS_STARTUP_DATA_BZ2 |
+ ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); |
+ i::Snapshot::set_raw_data( |
+ reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); |
+ |
+ ASSERT_EQ(i::Snapshot::context_raw_size(), |
+ decompressed_data[kSnapshotContext].raw_size); |
+ i::Snapshot::set_context_raw_data( |
+ reinterpret_cast<const i::byte*>( |
+ decompressed_data[kSnapshotContext].data)); |
+#endif |
+} |
+ |
+ |
void V8::SetFatalErrorHandler(FatalErrorCallback that) { |
i::Isolate* isolate = EnterIsolateIfNeeded(); |
isolate->set_exception_behavior(that); |