Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: src/api.cc

Issue 750543002: Rip out bzip compression for native sources. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: compressed_size Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/shell.cc ('k') | src/d8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 8f0dcf6bddb6bee8c5750f1b84e248da3de8a1c7..3a2e822e85a7349dc43c083d28b435f50585369c 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -196,134 +196,6 @@ static inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) {
}
-StartupDataDecompressor::StartupDataDecompressor()
- : raw_data(i::NewArray<char*>(V8::GetCompressedStartupDataCount())) {
- for (int i = 0; i < V8::GetCompressedStartupDataCount(); ++i) {
- raw_data[i] = NULL;
- }
-}
-
-
-StartupDataDecompressor::~StartupDataDecompressor() {
- for (int i = 0; i < V8::GetCompressedStartupDataCount(); ++i) {
- i::DeleteArray(raw_data[i]);
- }
- i::DeleteArray(raw_data);
-}
-
-
-int StartupDataDecompressor::Decompress() {
- int compressed_data_count = V8::GetCompressedStartupDataCount();
- StartupData* compressed_data =
- i::NewArray<StartupData>(compressed_data_count);
- V8::GetCompressedStartupData(compressed_data);
- for (int i = 0; i < compressed_data_count; ++i) {
- char* decompressed = raw_data[i] =
- i::NewArray<char>(compressed_data[i].raw_size);
- if (compressed_data[i].compressed_size != 0) {
- int result = DecompressData(decompressed,
- &compressed_data[i].raw_size,
- compressed_data[i].data,
- compressed_data[i].compressed_size);
- if (result != 0) return result;
- } else {
- DCHECK_EQ(0, compressed_data[i].raw_size);
- }
- compressed_data[i].data = decompressed;
- }
- V8::SetDecompressedStartupData(compressed_data);
- i::DeleteArray(compressed_data);
- return 0;
-}
-
-
-StartupData::CompressionAlgorithm V8::GetCompressedStartupDataAlgorithm() {
-#ifdef COMPRESS_STARTUP_DATA_BZ2
- return StartupData::kBZip2;
-#else
- return StartupData::kUncompressed;
-#endif
-}
-
-
-enum CompressedStartupDataItems {
- kSnapshot = 0,
- kSnapshotContext,
- kLibraries,
- kExperimentalLibraries,
- 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();
-
- i::Vector<const i::byte> libraries_source = i::Natives::GetScriptsSource();
- compressed_data[kLibraries].data =
- reinterpret_cast<const char*>(libraries_source.start());
- compressed_data[kLibraries].compressed_size = libraries_source.length();
- compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize();
-
- i::Vector<const i::byte> exp_libraries_source =
- i::ExperimentalNatives::GetScriptsSource();
- compressed_data[kExperimentalLibraries].data =
- reinterpret_cast<const char*>(exp_libraries_source.start());
- compressed_data[kExperimentalLibraries].compressed_size =
- exp_libraries_source.length();
- compressed_data[kExperimentalLibraries].raw_size =
- i::ExperimentalNatives::GetRawScriptsSize();
-#endif
-}
-
-
-void V8::SetDecompressedStartupData(StartupData* decompressed_data) {
-#ifdef COMPRESS_STARTUP_DATA_BZ2
- DCHECK_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size);
- i::Snapshot::set_raw_data(
- reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data));
-
- DCHECK_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));
-
- DCHECK_EQ(i::Natives::GetRawScriptsSize(),
- decompressed_data[kLibraries].raw_size);
- i::Vector<const char> libraries_source(
- decompressed_data[kLibraries].data,
- decompressed_data[kLibraries].raw_size);
- i::Natives::SetRawScriptsSource(libraries_source);
-
- DCHECK_EQ(i::ExperimentalNatives::GetRawScriptsSize(),
- decompressed_data[kExperimentalLibraries].raw_size);
- i::Vector<const char> exp_libraries_source(
- decompressed_data[kExperimentalLibraries].data,
- decompressed_data[kExperimentalLibraries].raw_size);
- i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source);
-#endif
-}
-
-
void V8::SetNativesDataBlob(StartupData* natives_blob) {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
i::SetNativesFromFile(natives_blob);
« no previous file with comments | « samples/shell.cc ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698