| 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 const int EXTRA_VM_ARGUMENTS = 1; | 519 const int EXTRA_VM_ARGUMENTS = 2; |
| 520 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS); | 520 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS); |
| 521 | 521 |
| 522 // Initialize the URL mapping array. | 522 // Initialize the URL mapping array. |
| 523 CommandLineOptions url_mapping_array(argc); | 523 CommandLineOptions url_mapping_array(argc); |
| 524 url_mapping = &url_mapping_array; | 524 url_mapping = &url_mapping_array; |
| 525 | 525 |
| 526 // Parse command line arguments. | 526 // Parse command line arguments. |
| 527 if (ParseArguments(argc, | 527 if (ParseArguments(argc, |
| 528 argv, | 528 argv, |
| 529 &vm_options, | 529 &vm_options, |
| 530 &app_script_name) < 0) { | 530 &app_script_name) < 0) { |
| 531 PrintUsage(); | 531 PrintUsage(); |
| 532 return 255; | 532 return 255; |
| 533 } | 533 } |
| 534 | 534 |
| 535 Thread::InitOnce(); | 535 Thread::InitOnce(); |
| 536 DartUtils::SetOriginalWorkingDirectory(); | 536 DartUtils::SetOriginalWorkingDirectory(); |
| 537 | 537 |
| 538 vm_options.AddArgument("--load_deferred_eagerly"); | 538 vm_options.AddArgument("--load_deferred_eagerly"); |
| 539 | 539 // Workaround until issue 21620 is fixed. |
| 540 // (https://github.com/dart-lang/sdk/issues/21620) |
| 541 vm_options.AddArgument("--no-concurrent_sweep"); |
| 540 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 542 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 541 | 543 |
| 542 // Initialize the Dart VM. | 544 // Initialize the Dart VM. |
| 543 // Note: We don't expect isolates to be created from dart code during | 545 // Note: We don't expect isolates to be created from dart code during |
| 544 // snapshot generation. | 546 // snapshot generation. |
| 545 if (!Dart_Initialize(NULL, | 547 if (!Dart_Initialize(NULL, |
| 546 NULL, NULL, NULL, NULL, | 548 NULL, NULL, NULL, NULL, |
| 547 DartUtils::OpenFile, | 549 DartUtils::OpenFile, |
| 548 DartUtils::ReadFile, | 550 DartUtils::ReadFile, |
| 549 DartUtils::WriteFile, | 551 DartUtils::WriteFile, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 } | 630 } |
| 629 return 0; | 631 return 0; |
| 630 } | 632 } |
| 631 | 633 |
| 632 } // namespace bin | 634 } // namespace bin |
| 633 } // namespace dart | 635 } // namespace dart |
| 634 | 636 |
| 635 int main(int argc, char** argv) { | 637 int main(int argc, char** argv) { |
| 636 return dart::bin::main(argc, argv); | 638 return dart::bin::main(argc, argv); |
| 637 } | 639 } |
| OLD | NEW |