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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 DartUtils::OpenFile, | 547 DartUtils::OpenFile, |
548 DartUtils::ReadFile, | 548 DartUtils::ReadFile, |
549 DartUtils::WriteFile, | 549 DartUtils::WriteFile, |
550 DartUtils::CloseFile, | 550 DartUtils::CloseFile, |
551 DartUtils::EntropySource)) { | 551 DartUtils::EntropySource)) { |
552 Log::PrintErr("VM initialization failed\n"); | 552 Log::PrintErr("VM initialization failed\n"); |
553 return 255; | 553 return 255; |
554 } | 554 } |
555 | 555 |
556 char* error; | 556 char* error; |
557 Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &error); | 557 Dart_Isolate isolate = Dart_CreateIsolate( |
| 558 NULL, NULL, NULL, NULL, NULL, &error); |
558 if (isolate == NULL) { | 559 if (isolate == NULL) { |
559 Log::PrintErr("Error: %s", error); | 560 Log::PrintErr("Error: %s", error); |
560 free(error); | 561 free(error); |
561 exit(255); | 562 exit(255); |
562 } | 563 } |
563 | 564 |
564 Dart_Handle result; | 565 Dart_Handle result; |
565 Dart_Handle library; | 566 Dart_Handle library; |
566 Dart_EnterScope(); | 567 Dart_EnterScope(); |
567 | 568 |
(...skipping 25 matching lines...) Expand all Loading... |
593 false, | 594 false, |
594 builtin_lib); | 595 builtin_lib); |
595 CHECK_RESULT(result); | 596 CHECK_RESULT(result); |
596 Dart_ExitScope(); | 597 Dart_ExitScope(); |
597 Dart_ExitIsolate(); | 598 Dart_ExitIsolate(); |
598 | 599 |
599 UriResolverIsolateScope::isolate = isolate; | 600 UriResolverIsolateScope::isolate = isolate; |
600 | 601 |
601 // Now we create an isolate into which we load all the code that needs to | 602 // Now we create an isolate into which we load all the code that needs to |
602 // be in the snapshot. | 603 // be in the snapshot. |
603 if (Dart_CreateIsolate(NULL, NULL, NULL, NULL, &error) == NULL) { | 604 if (Dart_CreateIsolate(NULL, NULL, NULL, NULL, NULL, &error) == NULL) { |
604 fprintf(stderr, "%s", error); | 605 fprintf(stderr, "%s", error); |
605 free(error); | 606 free(error); |
606 exit(255); | 607 exit(255); |
607 } | 608 } |
608 Dart_EnterScope(); | 609 Dart_EnterScope(); |
609 | 610 |
610 // Set up the library tag handler in such a manner that it will use the | 611 // Set up the library tag handler in such a manner that it will use the |
611 // URL mapping specified on the command line to load the libraries. | 612 // URL mapping specified on the command line to load the libraries. |
612 result = Dart_SetLibraryTagHandler(CreateSnapshotLibraryTagHandler); | 613 result = Dart_SetLibraryTagHandler(CreateSnapshotLibraryTagHandler); |
613 CHECK_RESULT(result); | 614 CHECK_RESULT(result); |
(...skipping 13 matching lines...) Expand all Loading... |
627 } | 628 } |
628 return 0; | 629 return 0; |
629 } | 630 } |
630 | 631 |
631 } // namespace bin | 632 } // namespace bin |
632 } // namespace dart | 633 } // namespace dart |
633 | 634 |
634 int main(int argc, char** argv) { | 635 int main(int argc, char** argv) { |
635 return dart::bin::main(argc, argv); | 636 return dart::bin::main(argc, argv); |
636 } | 637 } |
OLD | NEW |