| 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 <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 " --package_root=<path> Where to find packages, that is, \n" | 695 " --package_root=<path> Where to find packages, that is, \n" |
| 696 " package:... imports. \n" | 696 " package:... imports. \n" |
| 697 " \n" | 697 " \n" |
| 698 " --packages=<packages_file> Where to find a package spec file \n" | 698 " --packages=<packages_file> Where to find a package spec file \n" |
| 699 " \n" | 699 " \n" |
| 700 " --url_mapping=<mapping> Uses the URL mapping(s) specified on \n" | 700 " --url_mapping=<mapping> Uses the URL mapping(s) specified on \n" |
| 701 " the command line to load the \n" | 701 " the command line to load the \n" |
| 702 " libraries. \n" | 702 " libraries. \n" |
| 703 " \n" | 703 " \n" |
| 704 " To create a core snapshot: \n" | 704 " To create a core snapshot: \n" |
| 705 " --snapshot-kind=core \n" | 705 " --snapshot_kind=core \n" |
| 706 " --vm_snapshot_data=<output-file> \n" | 706 " --vm_snapshot_data=<output-file> \n" |
| 707 " --isolate_snapshot_data=<output-file> \n" | 707 " --isolate_snapshot_data=<output-file> \n" |
| 708 " [<dart-script-file>] \n" | 708 " [<dart-script-file>] \n" |
| 709 " \n" | 709 " \n" |
| 710 " Writes a snapshot of <dart-script-file> to the specified snapshot files. \n" | 710 " Writes a snapshot of <dart-script-file> to the specified snapshot files. \n" |
| 711 " If no <dart-script-file> is passed, a generic snapshot of all the corelibs \n" | 711 " If no <dart-script-file> is passed, a generic snapshot of all the corelibs \n" |
| 712 " is created. \n" | 712 " is created. \n" |
| 713 " \n" | 713 " \n" |
| 714 " To create a script snapshot with respect to a given core snapshot: \n" | 714 " To create a script snapshot with respect to a given core snapshot: \n" |
| 715 " --snapshot-kind=script \n" | 715 " --snapshot_kind=script \n" |
| 716 " --vm_snapshot_data=<intput-file> \n" | 716 " --vm_snapshot_data=<intput-file> \n" |
| 717 " --isolate_snapshot_data=<intput-file> \n" | 717 " --isolate_snapshot_data=<intput-file> \n" |
| 718 " --script_snapshot=<output-file> \n" | 718 " --script_snapshot=<output-file> \n" |
| 719 " <dart-script-file> \n" | 719 " <dart-script-file> \n" |
| 720 " \n" | 720 " \n" |
| 721 " Writes a snapshot of <dart-script-file> to the specified snapshot files. \n" | 721 " Writes a snapshot of <dart-script-file> to the specified snapshot files. \n" |
| 722 " If no <dart-script-file> is passed, a generic snapshot of all the corelibs\n" | 722 " If no <dart-script-file> is passed, a generic snapshot of all the corelibs\n" |
| 723 " is created. \n" | 723 " is created. \n" |
| 724 " \n" | 724 " \n" |
| 725 " To create an AOT application snapshot as blobs suitable for loading with \n" | 725 " To create an AOT application snapshot as blobs suitable for loading with \n" |
| 726 " mmap: \n" | 726 " mmap: \n" |
| 727 " --snapshot-kind=app-aot-blobs \n" | 727 " --snapshot_kind=app-aot-blobs \n" |
| 728 " --vm_snapshot_data=<output-file> \n" | 728 " --vm_snapshot_data=<output-file> \n" |
| 729 " --vm_snapshot_instructions=<output-file> \n" | 729 " --vm_snapshot_instructions=<output-file> \n" |
| 730 " --isolate_snapshot_data=<output-file> \n" | 730 " --isolate_snapshot_data=<output-file> \n" |
| 731 " --isolate_snapshot_instructions=<output-file> \n" | 731 " --isolate_snapshot_instructions=<output-file> \n" |
| 732 " {--embedder_entry_points_manifest=<input-file>} \n" | 732 " {--embedder_entry_points_manifest=<input-file>} \n" |
| 733 " <dart-script-file> \n" | 733 " <dart-script-file> \n" |
| 734 " \n" | 734 " \n" |
| 735 " To create an AOT application snapshot as assembly suitable for compilation \n" | 735 " To create an AOT application snapshot as assembly suitable for compilation \n" |
| 736 " as a static or dynamic library: \n" | 736 " as a static or dynamic library: \n" |
| 737 " mmap: \n" | 737 " mmap: \n" |
| 738 " --snapshot-kind=app-aot-blobs \n" | 738 " --snapshot_kind=app-aot-blobs \n" |
| 739 " --assembly=<output-file> \n" | 739 " --assembly=<output-file> \n" |
| 740 " {--embedder_entry_points_manifest=<input-file>} \n" | 740 " {--embedder_entry_points_manifest=<input-file>} \n" |
| 741 " <dart-script-file> \n" | 741 " <dart-script-file> \n" |
| 742 " \n" | 742 " \n" |
| 743 " AOT snapshots require entry points manifest files, which list the places \n" | 743 " AOT snapshots require entry points manifest files, which list the places \n" |
| 744 " in the Dart program the embedder calls from the C API (Dart_Invoke, etc). \n" | 744 " in the Dart program the embedder calls from the C API (Dart_Invoke, etc). \n" |
| 745 " Not specifying these may cause the tree shaker to remove them from the \n" | 745 " Not specifying these may cause the tree shaker to remove them from the \n" |
| 746 " program. The format of this manifest is as follows. Each line in the \n" | 746 " program. The format of this manifest is as follows. Each line in the \n" |
| 747 " manifest is a comma separated list of three elements. The first entry is \n" | 747 " manifest is a comma separated list of three elements. The first entry is \n" |
| 748 " the library URI, the second entry is the class name and the final entry \n" | 748 " the library URI, the second entry is the class name and the final entry \n" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 ASSERT(snapshot_kind == kScript); | 1129 ASSERT(snapshot_kind == kScript); |
| 1130 ASSERT(script_snapshot_filename != NULL); | 1130 ASSERT(script_snapshot_filename != NULL); |
| 1131 | 1131 |
| 1132 // First create a snapshot. | 1132 // First create a snapshot. |
| 1133 uint8_t* buffer = NULL; | 1133 uint8_t* buffer = NULL; |
| 1134 intptr_t size = 0; | 1134 intptr_t size = 0; |
| 1135 Dart_Handle result = Dart_CreateScriptSnapshot(&buffer, &size); | 1135 Dart_Handle result = Dart_CreateScriptSnapshot(&buffer, &size); |
| 1136 CHECK_RESULT(result); | 1136 CHECK_RESULT(result); |
| 1137 | 1137 |
| 1138 // Now write it out to the specified file. | 1138 // Now write it out to the specified file. |
| 1139 WriteSnapshotFile(script_snapshot_filename, buffer, size, true); | 1139 WriteSnapshotFile(script_snapshot_filename, buffer, size, false); |
| 1140 } | 1140 } |
| 1141 | 1141 |
| 1142 | 1142 |
| 1143 static void CreateAndWritePrecompiledSnapshot( | 1143 static void CreateAndWritePrecompiledSnapshot( |
| 1144 Dart_QualifiedFunctionName* standalone_entry_points) { | 1144 Dart_QualifiedFunctionName* standalone_entry_points) { |
| 1145 ASSERT(IsSnapshottingForPrecompilation()); | 1145 ASSERT(IsSnapshottingForPrecompilation()); |
| 1146 Dart_Handle result; | 1146 Dart_Handle result; |
| 1147 | 1147 |
| 1148 // Precompile with specified embedder entry points | 1148 // Precompile with specified embedder entry points |
| 1149 result = Dart_Precompile(standalone_entry_points, NULL, 0); | 1149 result = Dart_Precompile(standalone_entry_points, NULL, 0); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 delete mapped_isolate_snapshot_data; | 1519 delete mapped_isolate_snapshot_data; |
| 1520 return 0; | 1520 return 0; |
| 1521 } | 1521 } |
| 1522 | 1522 |
| 1523 } // namespace bin | 1523 } // namespace bin |
| 1524 } // namespace dart | 1524 } // namespace dart |
| 1525 | 1525 |
| 1526 int main(int argc, char** argv) { | 1526 int main(int argc, char** argv) { |
| 1527 return dart::bin::main(argc, argv); | 1527 return dart::bin::main(argc, argv); |
| 1528 } | 1528 } |
| OLD | NEW |