| OLD | NEW | 
|    1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |    1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include <errno.h> |    5 #include <errno.h> | 
|    6 #include <stdio.h> |    6 #include <stdio.h> | 
|    7 #ifdef COMPRESS_STARTUP_DATA_BZ2 |    7 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 
|    8 #include <bzlib.h> |    8 #include <bzlib.h> | 
|    9 #endif |    9 #endif | 
|   10 #include <signal.h> |   10 #include <signal.h> | 
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  296   fprintf(stderr, "%s at line %d\n", *message_string, message->GetLineNumber()); |  296   fprintf(stderr, "%s at line %d\n", *message_string, message->GetLineNumber()); | 
|  297   fprintf(stderr, "%s\n", *message_line); |  297   fprintf(stderr, "%s\n", *message_line); | 
|  298   for (int i = 0; i <= message->GetEndColumn(); ++i) { |  298   for (int i = 0; i <= message->GetEndColumn(); ++i) { | 
|  299     fprintf(stderr, "%c", i < message->GetStartColumn() ? ' ' : '^'); |  299     fprintf(stderr, "%c", i < message->GetStartColumn() ? ' ' : '^'); | 
|  300   } |  300   } | 
|  301   fprintf(stderr, "\n"); |  301   fprintf(stderr, "\n"); | 
|  302 } |  302 } | 
|  303  |  303  | 
|  304  |  304  | 
|  305 int main(int argc, char** argv) { |  305 int main(int argc, char** argv) { | 
 |  306   V8::InitializeICU(); | 
 |  307   v8::Platform* platform = v8::platform::CreateDefaultPlatform(); | 
 |  308   v8::V8::InitializePlatform(platform); | 
 |  309   i::CpuFeatures::Probe(true); | 
 |  310  | 
|  306   // By default, log code create information in the snapshot. |  311   // By default, log code create information in the snapshot. | 
|  307   i::FLAG_log_code = true; |  312   i::FLAG_log_code = true; | 
|  308  |  313  | 
|  309   // Print the usage if an error occurs when parsing the command line |  314   // Print the usage if an error occurs when parsing the command line | 
|  310   // flags or if the help flag is set. |  315   // flags or if the help flag is set. | 
|  311   int result = i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |  316   int result = i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); | 
|  312   if (result > 0 || argc != 2 || i::FLAG_help) { |  317   if (result > 0 || argc != 2 || i::FLAG_help) { | 
|  313     ::printf("Usage: %s [flag] ... outfile\n", argv[0]); |  318     ::printf("Usage: %s [flag] ... outfile\n", argv[0]); | 
|  314     i::FlagList::PrintHelp(); |  319     i::FlagList::PrintHelp(); | 
|  315     return !i::FLAG_help; |  320     return !i::FLAG_help; | 
|  316   } |  321   } | 
|  317  |  | 
|  318   V8::InitializeICU(); |  | 
|  319   v8::Platform* platform = v8::platform::CreateDefaultPlatform(); |  | 
|  320   v8::V8::InitializePlatform(platform); |  | 
|  321   v8::V8::Initialize(); |  | 
|  322   i::CpuFeatures::Probe(true); |  | 
|  323  |  | 
|  324 #ifdef COMPRESS_STARTUP_DATA_BZ2 |  322 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 
|  325   BZip2Decompressor natives_decompressor; |  323   BZip2Decompressor natives_decompressor; | 
|  326   int bz2_result = natives_decompressor.Decompress(); |  324   int bz2_result = natives_decompressor.Decompress(); | 
|  327   if (bz2_result != BZ_OK) { |  325   if (bz2_result != BZ_OK) { | 
|  328     fprintf(stderr, "bzip error code: %d\n", bz2_result); |  326     fprintf(stderr, "bzip error code: %d\n", bz2_result); | 
|  329     exit(1); |  327     exit(1); | 
|  330   } |  328   } | 
|  331 #endif |  329 #endif | 
|  332   i::FLAG_logfile_per_isolate = false; |  330   i::FLAG_logfile_per_isolate = false; | 
|  333  |  331  | 
|  334   Isolate::CreateParams params; |  332   Isolate* isolate = v8::Isolate::New(); | 
|  335   params.enable_serializer = true; |  | 
|  336   Isolate* isolate = v8::Isolate::New(params); |  | 
|  337   { Isolate::Scope isolate_scope(isolate); |  333   { Isolate::Scope isolate_scope(isolate); | 
|  338     i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |  334     i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 
 |  335     internal_isolate->enable_serializer(); | 
|  339  |  336  | 
|  340     Persistent<Context> context; |  337     Persistent<Context> context; | 
|  341     { |  338     { | 
|  342       HandleScope handle_scope(isolate); |  339       HandleScope handle_scope(isolate); | 
|  343       context.Reset(isolate, Context::New(isolate)); |  340       context.Reset(isolate, Context::New(isolate)); | 
|  344     } |  341     } | 
|  345  |  342  | 
|  346     if (context.IsEmpty()) { |  343     if (context.IsEmpty()) { | 
|  347       fprintf(stderr, |  344       fprintf(stderr, | 
|  348               "\nException thrown while compiling natives - see above.\n\n"); |  345               "\nException thrown while compiling natives - see above.\n\n"); | 
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  429       writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser); |  426       writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser); | 
|  430     } |  427     } | 
|  431   } |  428   } | 
|  432  |  429  | 
|  433   isolate->Dispose(); |  430   isolate->Dispose(); | 
|  434   V8::Dispose(); |  431   V8::Dispose(); | 
|  435   V8::ShutdownPlatform(); |  432   V8::ShutdownPlatform(); | 
|  436   delete platform; |  433   delete platform; | 
|  437   return 0; |  434   return 0; | 
|  438 } |  435 } | 
| OLD | NEW |