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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 | 1056 |
1057 // Precompile with specified embedder entry points | 1057 // Precompile with specified embedder entry points |
1058 result = Dart_Precompile(standalone_entry_points, NULL, 0); | 1058 result = Dart_Precompile(standalone_entry_points, NULL, 0); |
1059 CHECK_RESULT(result); | 1059 CHECK_RESULT(result); |
1060 | 1060 |
1061 // Create a precompiled snapshot. | 1061 // Create a precompiled snapshot. |
1062 bool as_assembly = assembly_filename != NULL; | 1062 bool as_assembly = assembly_filename != NULL; |
1063 if (as_assembly) { | 1063 if (as_assembly) { |
1064 uint8_t* assembly_buffer = NULL; | 1064 uint8_t* assembly_buffer = NULL; |
1065 intptr_t assembly_size = 0; | 1065 intptr_t assembly_size = 0; |
1066 result = Dart_CreatePrecompiledSnapshotAssembly(&assembly_buffer, | 1066 result = |
1067 &assembly_size); | 1067 Dart_CreateAppAOTSnapshotAsAssembly(&assembly_buffer, &assembly_size); |
1068 CHECK_RESULT(result); | 1068 CHECK_RESULT(result); |
1069 WriteSnapshotFile(assembly_filename, assembly_buffer, assembly_size); | 1069 WriteSnapshotFile(assembly_filename, assembly_buffer, assembly_size); |
1070 } else { | 1070 } else { |
1071 uint8_t* vm_isolate_buffer = NULL; | 1071 uint8_t* vm_isolate_buffer = NULL; |
1072 intptr_t vm_isolate_size = 0; | 1072 intptr_t vm_isolate_size = 0; |
1073 uint8_t* isolate_buffer = NULL; | 1073 uint8_t* isolate_buffer = NULL; |
1074 intptr_t isolate_size = 0; | 1074 intptr_t isolate_size = 0; |
1075 uint8_t* instructions_blob_buffer = NULL; | 1075 uint8_t* instructions_blob_buffer = NULL; |
1076 intptr_t instructions_blob_size = 0; | 1076 intptr_t instructions_blob_size = 0; |
1077 uint8_t* rodata_blob_buffer = NULL; | 1077 uint8_t* rodata_blob_buffer = NULL; |
1078 intptr_t rodata_blob_size = 0; | 1078 intptr_t rodata_blob_size = 0; |
1079 result = Dart_CreatePrecompiledSnapshotBlob( | 1079 result = Dart_CreateAppAOTSnapshotAsBlobs( |
1080 &vm_isolate_buffer, &vm_isolate_size, &isolate_buffer, &isolate_size, | 1080 &vm_isolate_buffer, &vm_isolate_size, &isolate_buffer, &isolate_size, |
1081 &instructions_blob_buffer, &instructions_blob_size, &rodata_blob_buffer, | 1081 &instructions_blob_buffer, &instructions_blob_size, &rodata_blob_buffer, |
1082 &rodata_blob_size); | 1082 &rodata_blob_size); |
1083 CHECK_RESULT(result); | 1083 CHECK_RESULT(result); |
1084 WriteSnapshotFile(vm_isolate_snapshot_filename, vm_isolate_buffer, | 1084 WriteSnapshotFile(vm_isolate_snapshot_filename, vm_isolate_buffer, |
1085 vm_isolate_size); | 1085 vm_isolate_size); |
1086 WriteSnapshotFile(isolate_snapshot_filename, isolate_buffer, isolate_size); | 1086 WriteSnapshotFile(isolate_snapshot_filename, isolate_buffer, isolate_size); |
1087 WriteSnapshotFile(instructions_blob_filename, instructions_blob_buffer, | 1087 WriteSnapshotFile(instructions_blob_filename, instructions_blob_buffer, |
1088 instructions_blob_size); | 1088 instructions_blob_size); |
1089 WriteSnapshotFile(rodata_blob_filename, rodata_blob_buffer, | 1089 WriteSnapshotFile(rodata_blob_filename, rodata_blob_buffer, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 EventHandler::Stop(); | 1371 EventHandler::Stop(); |
1372 return 0; | 1372 return 0; |
1373 } | 1373 } |
1374 | 1374 |
1375 } // namespace bin | 1375 } // namespace bin |
1376 } // namespace dart | 1376 } // namespace dart |
1377 | 1377 |
1378 int main(int argc, char** argv) { | 1378 int main(int argc, char** argv) { |
1379 return dart::bin::main(argc, argv); | 1379 return dart::bin::main(argc, argv); |
1380 } | 1380 } |
OLD | NEW |