| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 | 537 |
| 538 vm_options.AddArgument("--load_deferred_eagerly"); | 538 vm_options.AddArgument("--load_deferred_eagerly"); |
| 539 // Workaround until issue 21620 is fixed. | 539 // Workaround until issue 21620 is fixed. |
| 540 // (https://github.com/dart-lang/sdk/issues/21620) | 540 // (https://github.com/dart-lang/sdk/issues/21620) |
| 541 vm_options.AddArgument("--no-concurrent_sweep"); | 541 vm_options.AddArgument("--no-concurrent_sweep"); |
| 542 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 542 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 543 | 543 |
| 544 // Initialize the Dart VM. | 544 // Initialize the Dart VM. |
| 545 // 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 |
| 546 // snapshot generation. | 546 // snapshot generation. |
| 547 if (!Dart_Initialize(NULL, NULL, | 547 char* error = Dart_Initialize(NULL, NULL, |
| 548 NULL, NULL, NULL, NULL, | 548 NULL, NULL, NULL, NULL, |
| 549 DartUtils::OpenFile, | 549 DartUtils::OpenFile, |
| 550 DartUtils::ReadFile, | 550 DartUtils::ReadFile, |
| 551 DartUtils::WriteFile, | 551 DartUtils::WriteFile, |
| 552 DartUtils::CloseFile, | 552 DartUtils::CloseFile, |
| 553 DartUtils::EntropySource)) { | 553 DartUtils::EntropySource); |
| 554 Log::PrintErr("VM initialization failed\n"); | 554 if (error != NULL) { |
| 555 Log::PrintErr("VM initialization failed: %s\n", error); |
| 556 free(error); |
| 555 return 255; | 557 return 255; |
| 556 } | 558 } |
| 557 | 559 |
| 558 char* error; | |
| 559 Dart_Isolate isolate = Dart_CreateIsolate( | 560 Dart_Isolate isolate = Dart_CreateIsolate( |
| 560 NULL, NULL, NULL, NULL, NULL, &error); | 561 NULL, NULL, NULL, NULL, NULL, &error); |
| 561 if (isolate == NULL) { | 562 if (isolate == NULL) { |
| 562 Log::PrintErr("Error: %s", error); | 563 Log::PrintErr("Error: %s", error); |
| 563 free(error); | 564 free(error); |
| 564 exit(255); | 565 exit(255); |
| 565 } | 566 } |
| 566 | 567 |
| 567 Dart_Handle result; | 568 Dart_Handle result; |
| 568 Dart_Handle library; | 569 Dart_Handle library; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 } | 632 } |
| 632 return 0; | 633 return 0; |
| 633 } | 634 } |
| 634 | 635 |
| 635 } // namespace bin | 636 } // namespace bin |
| 636 } // namespace dart | 637 } // namespace dart |
| 637 | 638 |
| 638 int main(int argc, char** argv) { | 639 int main(int argc, char** argv) { |
| 639 return dart::bin::main(argc, argv); | 640 return dart::bin::main(argc, argv); |
| 640 } | 641 } |
| OLD | NEW |