| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Generate a snapshot file after loading all the scripts specified on the | 5 // Generate a snapshot file after loading all the scripts specified on the |
| 6 // command line. | 6 // command line. |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 const char* err_msg = Dart_GetError(library); | 509 const char* err_msg = Dart_GetError(library); |
| 510 Log::PrintErr("Errors encountered while loading: %s\n", err_msg); | 510 Log::PrintErr("Errors encountered while loading: %s\n", err_msg); |
| 511 Dart_ExitScope(); | 511 Dart_ExitScope(); |
| 512 Dart_ShutdownIsolate(); | 512 Dart_ShutdownIsolate(); |
| 513 exit(255); | 513 exit(255); |
| 514 } | 514 } |
| 515 } | 515 } |
| 516 | 516 |
| 517 | 517 |
| 518 int main(int argc, char** argv) { | 518 int main(int argc, char** argv) { |
| 519 CommandLineOptions vm_options(argc); | 519 const int EXTRA_VM_ARGUMENTS = 1; |
| 520 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS); |
| 520 | 521 |
| 521 // Initialize the URL mapping array. | 522 // Initialize the URL mapping array. |
| 522 CommandLineOptions url_mapping_array(argc); | 523 CommandLineOptions url_mapping_array(argc); |
| 523 url_mapping = &url_mapping_array; | 524 url_mapping = &url_mapping_array; |
| 524 | 525 |
| 525 // Parse command line arguments. | 526 // Parse command line arguments. |
| 526 if (ParseArguments(argc, | 527 if (ParseArguments(argc, |
| 527 argv, | 528 argv, |
| 528 &vm_options, | 529 &vm_options, |
| 529 &app_script_name) < 0) { | 530 &app_script_name) < 0) { |
| 530 PrintUsage(); | 531 PrintUsage(); |
| 531 return 255; | 532 return 255; |
| 532 } | 533 } |
| 533 | 534 |
| 534 Thread::InitOnce(); | 535 Thread::InitOnce(); |
| 535 DartUtils::SetOriginalWorkingDirectory(); | 536 DartUtils::SetOriginalWorkingDirectory(); |
| 536 | 537 |
| 538 vm_options.AddArgument("--load_deferred_eagerly"); |
| 539 |
| 537 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 540 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 538 | 541 |
| 539 // Initialize the Dart VM. | 542 // Initialize the Dart VM. |
| 540 // Note: We don't expect isolates to be created from dart code during | 543 // Note: We don't expect isolates to be created from dart code during |
| 541 // snapshot generation. | 544 // snapshot generation. |
| 542 if (!Dart_Initialize(NULL, | 545 if (!Dart_Initialize(NULL, |
| 543 NULL, NULL, NULL, NULL, | 546 NULL, NULL, NULL, NULL, |
| 544 DartUtils::OpenFile, | 547 DartUtils::OpenFile, |
| 545 DartUtils::ReadFile, | 548 DartUtils::ReadFile, |
| 546 DartUtils::WriteFile, | 549 DartUtils::WriteFile, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 } | 627 } |
| 625 return 0; | 628 return 0; |
| 626 } | 629 } |
| 627 | 630 |
| 628 } // namespace bin | 631 } // namespace bin |
| 629 } // namespace dart | 632 } // namespace dart |
| 630 | 633 |
| 631 int main(int argc, char** argv) { | 634 int main(int argc, char** argv) { |
| 632 return dart::bin::main(argc, argv); | 635 return dart::bin::main(argc, argv); |
| 633 } | 636 } |
| OLD | NEW |