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

Side by Side Diff: samples/shell.cc

Issue 7066048: Compress sources of JS libraries in addition to the snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/SConscript » ('j') | src/SConscript » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 302 }
303 } 303 }
304 304
305 #ifdef COMPRESS_STARTUP_DATA_BZ2 305 #ifdef COMPRESS_STARTUP_DATA_BZ2
306 ASSERT_EQ(v8::StartupData::kBZip2, 306 ASSERT_EQ(v8::StartupData::kBZip2,
307 v8::V8::GetCompressedStartupDataAlgorithm()); 307 v8::V8::GetCompressedStartupDataAlgorithm());
308 int compressed_data_count = v8::V8::GetCompressedStartupDataCount(); 308 int compressed_data_count = v8::V8::GetCompressedStartupDataCount();
309 v8::StartupData* compressed_data = new v8::StartupData[compressed_data_count]; 309 v8::StartupData* compressed_data = new v8::StartupData[compressed_data_count];
310 v8::V8::GetCompressedStartupData(compressed_data); 310 v8::V8::GetCompressedStartupData(compressed_data);
311 for (int i = 0; i < compressed_data_count; ++i) { 311 for (int i = 0; i < compressed_data_count; ++i) {
312 char* decompressed = new char[compressed_data[i].raw_size];
313 unsigned int decompressed_size = compressed_data[i].raw_size; 312 unsigned int decompressed_size = compressed_data[i].raw_size;
314 int result = 313 char* decompressed = new char[decompressed_size];
315 BZ2_bzBuffToBuffDecompress(decompressed, 314 if (compressed_data[i].compressed_size != 0) {
Vitaly Repeshko 2011/06/06 10:08:23 When does this happen?
mnaganov (inactive) 2011/06/06 13:40:18 When there is no snapshot. See snapshot-empty.cc.
316 &decompressed_size, 315 int result =
317 const_cast<char*>(compressed_data[i].data), 316 BZ2_bzBuffToBuffDecompress(decompressed,
318 compressed_data[i].compressed_size, 317 &decompressed_size,
319 0, 1); 318 const_cast<char*>(compressed_data[i].data),
320 if (result != BZ_OK) { 319 compressed_data[i].compressed_size,
321 fprintf(stderr, "bzip error code: %d\n", result); 320 0, 1);
322 exit(1); 321 if (result != BZ_OK) {
322 fprintf(stderr, "bzip error code: %d\n", result);
323 exit(1);
324 }
323 } 325 }
324 compressed_data[i].data = decompressed; 326 compressed_data[i].data = decompressed;
Vitaly Repeshko 2011/06/06 10:08:23 It seems strange that we assign a block of fresh u
mnaganov (inactive) 2011/06/06 13:40:18 We should never read from it in this case. I've ad
325 compressed_data[i].raw_size = decompressed_size; 327 compressed_data[i].raw_size = decompressed_size;
326 } 328 }
327 v8::V8::SetDecompressedStartupData(compressed_data); 329 v8::V8::SetDecompressedStartupData(compressed_data);
328 #endif // COMPRESS_STARTUP_DATA_BZ2 330 #endif // COMPRESS_STARTUP_DATA_BZ2
329 331
330 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); 332 v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
331 int result = 0; 333 int result = 0;
332 if (FLAG_stress_opt || FLAG_stress_deopt) { 334 if (FLAG_stress_opt || FLAG_stress_deopt) {
333 v8::Testing::SetStressRunType(FLAG_stress_opt 335 v8::Testing::SetStressRunType(FLAG_stress_opt
334 ? v8::Testing::kStressTypeOpt 336 ? v8::Testing::kStressTypeOpt
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 printf("^"); 673 printf("^");
672 } 674 }
673 printf("\n"); 675 printf("\n");
674 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); 676 v8::String::Utf8Value stack_trace(try_catch->StackTrace());
675 if (stack_trace.length() > 0) { 677 if (stack_trace.length() > 0) {
676 const char* stack_trace_string = ToCString(stack_trace); 678 const char* stack_trace_string = ToCString(stack_trace);
677 printf("%s\n", stack_trace_string); 679 printf("%s\n", stack_trace_string);
678 } 680 }
679 } 681 }
680 } 682 }
OLDNEW
« no previous file with comments | « no previous file | src/SConscript » ('j') | src/SConscript » ('J')

Powered by Google App Engine
This is Rietveld 408576698