| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "platform/globals.h" | 27 #include "platform/globals.h" |
| 28 #include "platform/hashmap.h" | 28 #include "platform/hashmap.h" |
| 29 #include "platform/text_buffer.h" | 29 #include "platform/text_buffer.h" |
| 30 #if !defined(DART_PRECOMPILER) | 30 #if !defined(DART_PRECOMPILER) |
| 31 #include "zlib/zlib.h" | 31 #include "zlib/zlib.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 namespace dart { | 34 namespace dart { |
| 35 namespace bin { | 35 namespace bin { |
| 36 | 36 |
| 37 // vm_isolate_snapshot_buffer points to a snapshot for the vm isolate if we | 37 // Snapshot pieces if we link in a snapshot, otherwise initialized to NULL. |
| 38 // link in a snapshot otherwise it is initialized to NULL. | 38 extern const uint8_t* vm_snapshot_data; |
| 39 extern const uint8_t* vm_isolate_snapshot_buffer; | 39 extern const uint8_t* vm_snapshot_instructions; |
| 40 | 40 extern const uint8_t* core_isolate_snapshot_data; |
| 41 // isolate_snapshot_buffer points to a snapshot for an isolate if we link in a | 41 extern const uint8_t* core_isolate_snapshot_instructions; |
| 42 // snapshot otherwise it is initialized to NULL. | |
| 43 extern const uint8_t* core_isolate_snapshot_buffer; | |
| 44 | |
| 45 | 42 |
| 46 /** | 43 /** |
| 47 * Global state used to control and store generation of application snapshots | 44 * Global state used to control and store generation of application snapshots |
| 48 * An application snapshot can be generated and run using the following | 45 * An application snapshot can be generated and run using the following |
| 49 * command | 46 * command |
| 50 * dart --snapshot-kind=app-jit --snapshot=<app_snapshot_filename> | 47 * dart --snapshot-kind=app-jit --snapshot=<app_snapshot_filename> |
| 51 * <script_uri> [<script_options>] | 48 * <script_uri> [<script_options>] |
| 52 * To Run the application snapshot generated above, use : | 49 * To Run the application snapshot generated above, use : |
| 53 * dart <app_snapshot_filename> [<script_options>] | 50 * dart <app_snapshot_filename> [<script_options>] |
| 54 */ | 51 */ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // dart functions and not run anything. | 88 // dart functions and not run anything. |
| 92 static bool compile_all = false; | 89 static bool compile_all = false; |
| 93 static bool parse_all = false; | 90 static bool parse_all = false; |
| 94 | 91 |
| 95 | 92 |
| 96 // Global flag that is used to indicate that we want to use blobs/mmap instead | 93 // Global flag that is used to indicate that we want to use blobs/mmap instead |
| 97 // of assembly/shared libraries for precompilation. | 94 // of assembly/shared libraries for precompilation. |
| 98 static bool use_blobs = false; | 95 static bool use_blobs = false; |
| 99 | 96 |
| 100 | 97 |
| 101 extern const char* kPrecompiledVMIsolateSymbolName; | 98 extern const char* kVmSnapshotDataSymbolName; |
| 102 extern const char* kPrecompiledIsolateSymbolName; | 99 extern const char* kVmSnapshotInstructionsSymbolName; |
| 103 extern const char* kPrecompiledInstructionsSymbolName; | 100 extern const char* kIsolateSnapshotDataSymbolName; |
| 104 extern const char* kPrecompiledDataSymbolName; | 101 extern const char* kIsolateSnapshotInstructionsSymbolName; |
| 105 | 102 |
| 106 | 103 |
| 107 // Global flag that is used to indicate that we want to trace resolution of | 104 // Global flag that is used to indicate that we want to trace resolution of |
| 108 // URIs and the loading of libraries, parts and scripts. | 105 // URIs and the loading of libraries, parts and scripts. |
| 109 static bool trace_loading = false; | 106 static bool trace_loading = false; |
| 110 | 107 |
| 111 | 108 |
| 112 static char* app_script_uri = NULL; | 109 static char* app_script_uri = NULL; |
| 113 static const uint8_t* app_isolate_snapshot_buffer = NULL; | 110 static const uint8_t* app_isolate_snapshot_data = NULL; |
| 111 static const uint8_t* app_isolate_snapshot_instructions = NULL; |
| 114 | 112 |
| 115 | 113 |
| 116 static Dart_Isolate main_isolate = NULL; | 114 static Dart_Isolate main_isolate = NULL; |
| 117 | 115 |
| 118 | 116 |
| 119 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "localhost"; | 117 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "localhost"; |
| 120 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 8181; | 118 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 8181; |
| 121 // VM Service options. | 119 // VM Service options. |
| 122 static const char* vm_service_server_ip = DEFAULT_VM_SERVICE_SERVER_IP; | 120 static const char* vm_service_server_ip = DEFAULT_VM_SERVICE_SERVER_IP; |
| 123 // The 0 port is a magic value which results in the first available port | 121 // The 0 port is a magic value which results in the first available port |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 } else { | 826 } else { |
| 829 if (packages_config == NULL) { | 827 if (packages_config == NULL) { |
| 830 packages_config = commandline_packages_file; | 828 packages_config = commandline_packages_file; |
| 831 } | 829 } |
| 832 } | 830 } |
| 833 } | 831 } |
| 834 | 832 |
| 835 #if defined(DART_PRECOMPILED_RUNTIME) | 833 #if defined(DART_PRECOMPILED_RUNTIME) |
| 836 // AOT: All isolates start from the app snapshot. | 834 // AOT: All isolates start from the app snapshot. |
| 837 bool isolate_run_app_snapshot = true; | 835 bool isolate_run_app_snapshot = true; |
| 838 const uint8_t* isolate_snapshot_buffer = app_isolate_snapshot_buffer; | 836 const uint8_t* isolate_snapshot_data = app_isolate_snapshot_data; |
| 837 const uint8_t* isolate_snapshot_instructions = |
| 838 app_isolate_snapshot_instructions; |
| 839 #else | 839 #else |
| 840 // JIT: Main isolate starts from the app snapshot, if any. Other use the | 840 // JIT: Main isolate starts from the app snapshot, if any. Other isolates |
| 841 // core libraries snapshot. | 841 // use the core libraries snapshot. |
| 842 bool isolate_run_app_snapshot = false; | 842 bool isolate_run_app_snapshot = false; |
| 843 const uint8_t* isolate_snapshot_buffer = core_isolate_snapshot_buffer; | 843 const uint8_t* isolate_snapshot_data = core_isolate_snapshot_data; |
| 844 if ((app_isolate_snapshot_buffer != NULL) && | 844 const uint8_t* isolate_snapshot_instructions = |
| 845 core_isolate_snapshot_instructions; |
| 846 if ((app_isolate_snapshot_data != NULL) && |
| 845 (is_main_isolate || ((app_script_uri != NULL) && | 847 (is_main_isolate || ((app_script_uri != NULL) && |
| 846 (strcmp(script_uri, app_script_uri) == 0)))) { | 848 (strcmp(script_uri, app_script_uri) == 0)))) { |
| 847 isolate_run_app_snapshot = true; | 849 isolate_run_app_snapshot = true; |
| 848 isolate_snapshot_buffer = app_isolate_snapshot_buffer; | 850 isolate_snapshot_data = app_isolate_snapshot_data; |
| 851 isolate_snapshot_instructions = app_isolate_snapshot_instructions; |
| 849 } | 852 } |
| 850 #endif | 853 #endif |
| 851 | 854 |
| 852 // If the script is a Kernel binary, then we will try to bootstrap from the | 855 // If the script is a Kernel binary, then we will try to bootstrap from the |
| 853 // script. | 856 // script. |
| 854 const uint8_t* kernel_file = NULL; | 857 const uint8_t* kernel_file = NULL; |
| 855 intptr_t kernel_length = -1; | 858 intptr_t kernel_length = -1; |
| 856 const bool is_kernel = | 859 const bool is_kernel = |
| 857 !isolate_run_app_snapshot && | 860 !isolate_run_app_snapshot && |
| 858 TryReadKernel(script_uri, &kernel_file, &kernel_length); | 861 TryReadKernel(script_uri, &kernel_file, &kernel_length); |
| 859 | 862 |
| 860 void* kernel_program = NULL; | 863 void* kernel_program = NULL; |
| 861 if (is_kernel) { | 864 if (is_kernel) { |
| 862 kernel_program = Dart_ReadKernelBinary(kernel_file, kernel_length); | 865 kernel_program = Dart_ReadKernelBinary(kernel_file, kernel_length); |
| 863 free(const_cast<uint8_t*>(kernel_file)); | 866 free(const_cast<uint8_t*>(kernel_file)); |
| 864 } | 867 } |
| 865 | 868 |
| 866 IsolateData* isolate_data = | 869 IsolateData* isolate_data = |
| 867 new IsolateData(script_uri, package_root, packages_config); | 870 new IsolateData(script_uri, package_root, packages_config); |
| 868 Dart_Isolate isolate = | 871 Dart_Isolate isolate = |
| 869 is_kernel ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_program, | 872 is_kernel ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_program, |
| 870 flags, isolate_data, error) | 873 flags, isolate_data, error) |
| 871 : Dart_CreateIsolate(script_uri, main, isolate_snapshot_buffer, | 874 : Dart_CreateIsolate(script_uri, main, isolate_snapshot_data, |
| 872 flags, isolate_data, error); | 875 isolate_snapshot_instructions, flags, |
| 876 isolate_data, error); |
| 873 if (isolate == NULL) { | 877 if (isolate == NULL) { |
| 874 delete isolate_data; | 878 delete isolate_data; |
| 875 return NULL; | 879 return NULL; |
| 876 } | 880 } |
| 877 | 881 |
| 878 Dart_EnterScope(); | 882 Dart_EnterScope(); |
| 879 | 883 |
| 880 // Set up the library tag handler for this isolate. | 884 // Set up the library tag handler for this isolate. |
| 881 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); | 885 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); |
| 882 CHECK_RESULT(result); | 886 CHECK_RESULT(result); |
| 883 | 887 |
| 884 if (is_kernel) { | 888 if (is_kernel) { |
| 885 Dart_Handle result = Dart_LoadKernel(kernel_program); | 889 Dart_Handle result = Dart_LoadKernel(kernel_program); |
| 886 CHECK_RESULT(result); | 890 CHECK_RESULT(result); |
| 887 } | 891 } |
| 888 if (is_kernel || (isolate_snapshot_buffer != NULL)) { | 892 if (is_kernel || (isolate_snapshot_data != NULL)) { |
| 889 // Setup the native resolver as the snapshot does not carry it. | 893 // Setup the native resolver as the snapshot does not carry it. |
| 890 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); | 894 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); |
| 891 Builtin::SetNativeResolver(Builtin::kIOLibrary); | 895 Builtin::SetNativeResolver(Builtin::kIOLibrary); |
| 892 } | 896 } |
| 893 if (isolate_run_app_snapshot) { | 897 if (isolate_run_app_snapshot) { |
| 894 Dart_Handle result = Loader::ReloadNativeExtensions(); | 898 Dart_Handle result = Loader::ReloadNativeExtensions(); |
| 895 CHECK_RESULT(result); | 899 CHECK_RESULT(result); |
| 896 } | 900 } |
| 897 | 901 |
| 898 if (Dart_IsServiceIsolate(isolate)) { | 902 if (Dart_IsServiceIsolate(isolate)) { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 } | 1287 } |
| 1284 } | 1288 } |
| 1285 | 1289 |
| 1286 | 1290 |
| 1287 static const int64_t kAppSnapshotHeaderSize = 5 * sizeof(int64_t); // NOLINT | 1291 static const int64_t kAppSnapshotHeaderSize = 5 * sizeof(int64_t); // NOLINT |
| 1288 static const int64_t kAppSnapshotMagicNumber = 0xf6f6dcdc; | 1292 static const int64_t kAppSnapshotMagicNumber = 0xf6f6dcdc; |
| 1289 static const int64_t kAppSnapshotPageSize = 4 * KB; | 1293 static const int64_t kAppSnapshotPageSize = 4 * KB; |
| 1290 | 1294 |
| 1291 | 1295 |
| 1292 static bool ReadAppSnapshotBlobs(const char* script_name, | 1296 static bool ReadAppSnapshotBlobs(const char* script_name, |
| 1293 const uint8_t** vmisolate_buffer, | 1297 const uint8_t** vm_data_buffer, |
| 1294 const uint8_t** isolate_buffer, | 1298 const uint8_t** vm_instructions_buffer, |
| 1295 const uint8_t** instructions_buffer, | 1299 const uint8_t** isolate_data_buffer, |
| 1296 const uint8_t** rodata_buffer) { | 1300 const uint8_t** isolate_instructions_buffer) { |
| 1297 File* file = File::Open(script_name, File::kRead); | 1301 File* file = File::Open(script_name, File::kRead); |
| 1298 if (file == NULL) { | 1302 if (file == NULL) { |
| 1299 return false; | 1303 return false; |
| 1300 } | 1304 } |
| 1301 if (file->Length() < kAppSnapshotHeaderSize) { | 1305 if (file->Length() < kAppSnapshotHeaderSize) { |
| 1302 file->Release(); | 1306 file->Release(); |
| 1303 return false; | 1307 return false; |
| 1304 } | 1308 } |
| 1305 int64_t header[5]; | 1309 int64_t header[5]; |
| 1306 ASSERT(sizeof(header) == kAppSnapshotHeaderSize); | 1310 ASSERT(sizeof(header) == kAppSnapshotHeaderSize); |
| 1307 if (!file->ReadFully(&header, kAppSnapshotHeaderSize)) { | 1311 if (!file->ReadFully(&header, kAppSnapshotHeaderSize)) { |
| 1308 file->Release(); | 1312 file->Release(); |
| 1309 return false; | 1313 return false; |
| 1310 } | 1314 } |
| 1311 if (header[0] != kAppSnapshotMagicNumber) { | 1315 if (header[0] != kAppSnapshotMagicNumber) { |
| 1312 file->Release(); | 1316 file->Release(); |
| 1313 return false; | 1317 return false; |
| 1314 } | 1318 } |
| 1315 | 1319 |
| 1316 int64_t vmisolate_size = header[1]; | 1320 int64_t vm_data_size = header[1]; |
| 1317 int64_t vmisolate_position = | 1321 int64_t vm_data_position = |
| 1318 Utils::RoundUp(file->Position(), kAppSnapshotPageSize); | 1322 Utils::RoundUp(file->Position(), kAppSnapshotPageSize); |
| 1319 int64_t isolate_size = header[2]; | 1323 int64_t vm_instructions_size = header[2]; |
| 1320 int64_t isolate_position = | 1324 int64_t vm_instructions_position = vm_data_position + vm_data_size; |
| 1321 Utils::RoundUp(vmisolate_position + vmisolate_size, kAppSnapshotPageSize); | 1325 if (vm_instructions_size != 0) { |
| 1322 int64_t rodata_size = header[3]; | 1326 vm_instructions_position = |
| 1323 int64_t rodata_position = isolate_position + isolate_size; | 1327 Utils::RoundUp(vm_instructions_position, kAppSnapshotPageSize); |
| 1324 if (rodata_size != 0) { | |
| 1325 rodata_position = Utils::RoundUp(rodata_position, kAppSnapshotPageSize); | |
| 1326 } | 1328 } |
| 1327 int64_t instructions_size = header[4]; | 1329 int64_t isolate_data_size = header[3]; |
| 1328 int64_t instructions_position = rodata_position + rodata_size; | 1330 int64_t isolate_data_position = Utils::RoundUp( |
| 1329 if (instructions_size != 0) { | 1331 vm_instructions_position + vm_instructions_size, kAppSnapshotPageSize); |
| 1330 instructions_position = | 1332 int64_t isolate_instructions_size = header[4]; |
| 1331 Utils::RoundUp(instructions_position, kAppSnapshotPageSize); | 1333 int64_t isolate_instructions_position = |
| 1334 isolate_data_position + isolate_data_size; |
| 1335 if (isolate_instructions_size != 0) { |
| 1336 isolate_instructions_position = |
| 1337 Utils::RoundUp(isolate_instructions_position, kAppSnapshotPageSize); |
| 1332 } | 1338 } |
| 1333 | 1339 |
| 1334 void* read_only_buffer = | 1340 if (vm_data_size != 0) { |
| 1335 file->Map(File::kReadOnly, vmisolate_position, | 1341 *vm_data_buffer = reinterpret_cast<const uint8_t*>( |
| 1336 instructions_position - vmisolate_position); | 1342 file->Map(File::kReadOnly, vm_data_position, vm_data_size)); |
| 1337 if (read_only_buffer == NULL) { | 1343 if (vm_data_buffer == NULL) { |
| 1344 Log::PrintErr("Failed to memory map snapshot\n"); |
| 1345 Platform::Exit(kErrorExitCode); |
| 1346 } |
| 1347 } |
| 1348 |
| 1349 if (vm_instructions_size != 0) { |
| 1350 *vm_instructions_buffer = reinterpret_cast<const uint8_t*>(file->Map( |
| 1351 File::kReadExecute, vm_instructions_position, vm_instructions_size)); |
| 1352 if (*vm_instructions_buffer == NULL) { |
| 1353 Log::PrintErr("Failed to memory map snapshot\n"); |
| 1354 Platform::Exit(kErrorExitCode); |
| 1355 } |
| 1356 } |
| 1357 |
| 1358 *isolate_data_buffer = reinterpret_cast<const uint8_t*>( |
| 1359 file->Map(File::kReadOnly, isolate_data_position, isolate_data_size)); |
| 1360 if (isolate_data_buffer == NULL) { |
| 1338 Log::PrintErr("Failed to memory map snapshot\n"); | 1361 Log::PrintErr("Failed to memory map snapshot\n"); |
| 1339 Platform::Exit(kErrorExitCode); | 1362 Platform::Exit(kErrorExitCode); |
| 1340 } | 1363 } |
| 1341 | 1364 |
| 1342 if (vmisolate_size != 0) { | 1365 if (isolate_instructions_size == 0) { |
| 1343 *vmisolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) + | 1366 *isolate_instructions_buffer = NULL; |
| 1344 (vmisolate_position - vmisolate_position); | |
| 1345 } | |
| 1346 *isolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) + | |
| 1347 (isolate_position - vmisolate_position); | |
| 1348 if (rodata_size == 0) { | |
| 1349 *rodata_buffer = NULL; | |
| 1350 } else { | 1367 } else { |
| 1351 *rodata_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) + | 1368 *isolate_instructions_buffer = reinterpret_cast<const uint8_t*>( |
| 1352 (rodata_position - vmisolate_position); | 1369 file->Map(File::kReadExecute, isolate_instructions_position, |
| 1353 } | 1370 isolate_instructions_size)); |
| 1354 | 1371 if (*isolate_instructions_buffer == NULL) { |
| 1355 if (instructions_size == 0) { | |
| 1356 *instructions_buffer = NULL; | |
| 1357 } else { | |
| 1358 *instructions_buffer = reinterpret_cast<const uint8_t*>( | |
| 1359 file->Map(File::kReadExecute, instructions_position, header[4])); | |
| 1360 if (*instructions_buffer == NULL) { | |
| 1361 Log::PrintErr("Failed to memory map snapshot\n"); | 1372 Log::PrintErr("Failed to memory map snapshot\n"); |
| 1362 Platform::Exit(kErrorExitCode); | 1373 Platform::Exit(kErrorExitCode); |
| 1363 } | 1374 } |
| 1364 } | 1375 } |
| 1365 | 1376 |
| 1366 file->Release(); | 1377 file->Release(); |
| 1367 return true; | 1378 return true; |
| 1368 } | 1379 } |
| 1369 | 1380 |
| 1370 | 1381 |
| 1371 static bool ReadAppSnapshotDynamicLibrary(const char* script_name, | 1382 static bool ReadAppSnapshotDynamicLibrary( |
| 1372 const uint8_t** vmisolate_buffer, | 1383 const char* script_name, |
| 1373 const uint8_t** isolate_buffer, | 1384 const uint8_t** vm_data_buffer, |
| 1374 const uint8_t** instructions_buffer, | 1385 const uint8_t** vm_instructions_buffer, |
| 1375 const uint8_t** rodata_buffer) { | 1386 const uint8_t** isolate_data_buffer, |
| 1387 const uint8_t** isolate_instructions_buffer) { |
| 1376 void* library = Extensions::LoadExtensionLibrary(script_name); | 1388 void* library = Extensions::LoadExtensionLibrary(script_name); |
| 1377 if (library == NULL) { | 1389 if (library == NULL) { |
| 1378 return false; | 1390 return false; |
| 1379 } | 1391 } |
| 1380 | 1392 |
| 1381 *vmisolate_buffer = reinterpret_cast<const uint8_t*>( | 1393 *vm_data_buffer = reinterpret_cast<const uint8_t*>( |
| 1382 Extensions::ResolveSymbol(library, kPrecompiledVMIsolateSymbolName)); | 1394 Extensions::ResolveSymbol(library, kVmSnapshotDataSymbolName)); |
| 1383 if (*vmisolate_buffer == NULL) { | 1395 if (*vm_data_buffer == NULL) { |
| 1384 Log::PrintErr("Failed to resolve symbol '%s'\n", | 1396 Log::PrintErr("Failed to resolve symbol '%s'\n", kVmSnapshotDataSymbolName); |
| 1385 kPrecompiledVMIsolateSymbolName); | |
| 1386 Platform::Exit(kErrorExitCode); | 1397 Platform::Exit(kErrorExitCode); |
| 1387 } | 1398 } |
| 1388 | 1399 |
| 1389 *isolate_buffer = reinterpret_cast<const uint8_t*>( | 1400 *vm_instructions_buffer = reinterpret_cast<const uint8_t*>( |
| 1390 Extensions::ResolveSymbol(library, kPrecompiledIsolateSymbolName)); | 1401 Extensions::ResolveSymbol(library, kVmSnapshotInstructionsSymbolName)); |
| 1391 if (*isolate_buffer == NULL) { | 1402 if (*vm_instructions_buffer == NULL) { |
| 1392 Log::PrintErr("Failed to resolve symbol '%s'\n", | 1403 Log::PrintErr("Failed to resolve symbol '%s'\n", |
| 1393 kPrecompiledIsolateSymbolName); | 1404 kVmSnapshotInstructionsSymbolName); |
| 1394 Platform::Exit(kErrorExitCode); | 1405 Platform::Exit(kErrorExitCode); |
| 1395 } | 1406 } |
| 1396 | 1407 |
| 1397 *instructions_buffer = reinterpret_cast<const uint8_t*>( | 1408 *isolate_data_buffer = reinterpret_cast<const uint8_t*>( |
| 1398 Extensions::ResolveSymbol(library, kPrecompiledInstructionsSymbolName)); | 1409 Extensions::ResolveSymbol(library, kIsolateSnapshotDataSymbolName)); |
| 1399 if (*instructions_buffer == NULL) { | 1410 if (*isolate_data_buffer == NULL) { |
| 1400 Log::PrintErr("Failed to resolve symbol '%s'\n", | 1411 Log::PrintErr("Failed to resolve symbol '%s'\n", |
| 1401 kPrecompiledInstructionsSymbolName); | 1412 kIsolateSnapshotDataSymbolName); |
| 1402 Platform::Exit(kErrorExitCode); | 1413 Platform::Exit(kErrorExitCode); |
| 1403 } | 1414 } |
| 1404 | 1415 |
| 1405 *rodata_buffer = reinterpret_cast<const uint8_t*>( | 1416 *isolate_instructions_buffer = |
| 1406 Extensions::ResolveSymbol(library, kPrecompiledDataSymbolName)); | 1417 reinterpret_cast<const uint8_t*>(Extensions::ResolveSymbol( |
| 1407 if (*rodata_buffer == NULL) { | 1418 library, kIsolateSnapshotInstructionsSymbolName)); |
| 1419 if (*isolate_instructions_buffer == NULL) { |
| 1408 Log::PrintErr("Failed to resolve symbol '%s'\n", | 1420 Log::PrintErr("Failed to resolve symbol '%s'\n", |
| 1409 kPrecompiledDataSymbolName); | 1421 kIsolateSnapshotInstructionsSymbolName); |
| 1410 Platform::Exit(kErrorExitCode); | 1422 Platform::Exit(kErrorExitCode); |
| 1411 } | 1423 } |
| 1412 | 1424 |
| 1413 return true; | 1425 return true; |
| 1414 } | 1426 } |
| 1415 | 1427 |
| 1416 | 1428 |
| 1417 static bool ReadAppSnapshot(const char* script_name, | 1429 static bool ReadAppSnapshot(const char* script_name, |
| 1418 const uint8_t** vmisolate_buffer, | 1430 const uint8_t** vm_data_buffer, |
| 1419 const uint8_t** isolate_buffer, | 1431 const uint8_t** vm_instructions_buffer, |
| 1420 const uint8_t** instructions_buffer, | 1432 const uint8_t** isolate_data_buffer, |
| 1421 const uint8_t** rodata_buffer) { | 1433 const uint8_t** isolate_instructions_buffer) { |
| 1422 if (File::GetType(script_name, true) != File::kIsFile) { | 1434 if (File::GetType(script_name, true) != File::kIsFile) { |
| 1423 // If 'script_name' refers to a pipe, don't read to check for an app | 1435 // If 'script_name' refers to a pipe, don't read to check for an app |
| 1424 // snapshot since we cannot rewind if it isn't (and couldn't mmap it in | 1436 // snapshot since we cannot rewind if it isn't (and couldn't mmap it in |
| 1425 // anyway if it was). | 1437 // anyway if it was). |
| 1426 return false; | 1438 return false; |
| 1427 } | 1439 } |
| 1428 if (ReadAppSnapshotBlobs(script_name, vmisolate_buffer, isolate_buffer, | 1440 if (ReadAppSnapshotBlobs(script_name, vm_data_buffer, vm_instructions_buffer, |
| 1429 instructions_buffer, rodata_buffer)) { | 1441 isolate_data_buffer, isolate_instructions_buffer)) { |
| 1430 return true; | 1442 return true; |
| 1431 } | 1443 } |
| 1432 return ReadAppSnapshotDynamicLibrary(script_name, vmisolate_buffer, | 1444 return ReadAppSnapshotDynamicLibrary( |
| 1433 isolate_buffer, instructions_buffer, | 1445 script_name, vm_data_buffer, vm_instructions_buffer, isolate_data_buffer, |
| 1434 rodata_buffer); | 1446 isolate_instructions_buffer); |
| 1435 } | 1447 } |
| 1436 | 1448 |
| 1437 | 1449 |
| 1438 static bool WriteInt64(File* file, int64_t size) { | 1450 static bool WriteInt64(File* file, int64_t size) { |
| 1439 return file->WriteFully(&size, sizeof(size)); | 1451 return file->WriteFully(&size, sizeof(size)); |
| 1440 } | 1452 } |
| 1441 | 1453 |
| 1442 | 1454 |
| 1443 static void WriteAppSnapshot(const char* filename, | 1455 static void WriteAppSnapshot(const char* filename, |
| 1444 uint8_t* vmisolate_buffer, | 1456 uint8_t* vm_data_buffer, |
| 1445 intptr_t vmisolate_size, | 1457 intptr_t vm_data_size, |
| 1446 uint8_t* isolate_buffer, | 1458 uint8_t* vm_instructions_buffer, |
| 1447 intptr_t isolate_size, | 1459 intptr_t vm_instructions_size, |
| 1448 uint8_t* instructions_buffer, | 1460 uint8_t* isolate_data_buffer, |
| 1449 intptr_t instructions_size, | 1461 intptr_t isolate_data_size, |
| 1450 uint8_t* rodata_buffer, | 1462 uint8_t* isolate_instructions_buffer, |
| 1451 intptr_t rodata_size) { | 1463 intptr_t isolate_instructions_size) { |
| 1452 File* file = File::Open(filename, File::kWriteTruncate); | 1464 File* file = File::Open(filename, File::kWriteTruncate); |
| 1453 if (file == NULL) { | 1465 if (file == NULL) { |
| 1454 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename); | 1466 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename); |
| 1455 } | 1467 } |
| 1456 | 1468 |
| 1457 file->WriteFully(&kAppSnapshotMagicNumber, sizeof(kAppSnapshotMagicNumber)); | 1469 file->WriteFully(&kAppSnapshotMagicNumber, sizeof(kAppSnapshotMagicNumber)); |
| 1458 WriteInt64(file, vmisolate_size); | 1470 WriteInt64(file, vm_data_size); |
| 1459 WriteInt64(file, isolate_size); | 1471 WriteInt64(file, vm_instructions_size); |
| 1460 WriteInt64(file, rodata_size); | 1472 WriteInt64(file, isolate_data_size); |
| 1461 WriteInt64(file, instructions_size); | 1473 WriteInt64(file, isolate_instructions_size); |
| 1462 ASSERT(file->Position() == kAppSnapshotHeaderSize); | 1474 ASSERT(file->Position() == kAppSnapshotHeaderSize); |
| 1463 | 1475 |
| 1464 file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize)); | 1476 file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize)); |
| 1465 if (!file->WriteFully(vmisolate_buffer, vmisolate_size)) { | 1477 if (!file->WriteFully(vm_data_buffer, vm_data_size)) { |
| 1466 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename); | 1478 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename); |
| 1467 } | 1479 } |
| 1468 | 1480 |
| 1469 file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize)); | 1481 if (vm_instructions_size != 0) { |
| 1470 if (!file->WriteFully(isolate_buffer, isolate_size)) { | |
| 1471 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename); | |
| 1472 } | |
| 1473 | |
| 1474 if (rodata_size != 0) { | |
| 1475 file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize)); | 1482 file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize)); |
| 1476 if (!file->WriteFully(rodata_buffer, rodata_size)) { | 1483 if (!file->WriteFully(vm_instructions_buffer, vm_instructions_size)) { |
| 1477 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", | 1484 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", |
| 1478 filename); | 1485 filename); |
| 1479 } | 1486 } |
| 1480 } | 1487 } |
| 1481 | 1488 |
| 1482 if (instructions_size != 0) { | 1489 file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize)); |
| 1490 if (!file->WriteFully(isolate_data_buffer, isolate_data_size)) { |
| 1491 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename); |
| 1492 } |
| 1493 |
| 1494 if (isolate_instructions_size != 0) { |
| 1483 file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize)); | 1495 file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize)); |
| 1484 if (!file->WriteFully(instructions_buffer, instructions_size)) { | 1496 if (!file->WriteFully(isolate_instructions_buffer, |
| 1497 isolate_instructions_size)) { |
| 1485 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", | 1498 ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", |
| 1486 filename); | 1499 filename); |
| 1487 } | 1500 } |
| 1488 } | 1501 } |
| 1489 | 1502 |
| 1490 file->Flush(); | 1503 file->Flush(); |
| 1491 file->Release(); | 1504 file->Release(); |
| 1492 } | 1505 } |
| 1493 | 1506 |
| 1494 | 1507 |
| 1495 static void GenerateScriptSnapshot() { | 1508 static void GenerateScriptSnapshot() { |
| 1496 // First create a snapshot. | 1509 // First create a snapshot. |
| 1497 uint8_t* buffer = NULL; | 1510 uint8_t* buffer = NULL; |
| 1498 intptr_t size = 0; | 1511 intptr_t size = 0; |
| 1499 Dart_Handle result = Dart_CreateScriptSnapshot(&buffer, &size); | 1512 Dart_Handle result = Dart_CreateScriptSnapshot(&buffer, &size); |
| 1500 if (Dart_IsError(result)) { | 1513 if (Dart_IsError(result)) { |
| 1501 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); | 1514 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
| 1502 } | 1515 } |
| 1503 | 1516 |
| 1504 WriteSnapshotFile(snapshot_filename, true, buffer, size); | 1517 WriteSnapshotFile(snapshot_filename, true, buffer, size); |
| 1505 } | 1518 } |
| 1506 | 1519 |
| 1507 | 1520 |
| 1508 static void GeneratePrecompiledSnapshot() { | 1521 static void GenerateAppAOTSnapshotAsBlobs() { |
| 1509 uint8_t* vm_isolate_buffer = NULL; | 1522 uint8_t* vm_data_buffer = NULL; |
| 1510 intptr_t vm_isolate_size = 0; | 1523 intptr_t vm_data_size = 0; |
| 1511 uint8_t* isolate_buffer = NULL; | 1524 uint8_t* vm_instructions_buffer = NULL; |
| 1512 intptr_t isolate_size = 0; | 1525 intptr_t vm_instructions_size = 0; |
| 1513 uint8_t* assembly_buffer = NULL; | 1526 uint8_t* isolate_data_buffer = NULL; |
| 1514 intptr_t assembly_size = 0; | 1527 intptr_t isolate_data_size = 0; |
| 1515 uint8_t* instructions_blob_buffer = NULL; | 1528 uint8_t* isolate_instructions_buffer = NULL; |
| 1516 intptr_t instructions_blob_size = 0; | 1529 intptr_t isolate_instructions_size = 0; |
| 1517 uint8_t* rodata_blob_buffer = NULL; | 1530 Dart_Handle result = Dart_CreateAppAOTSnapshotAsBlobs( |
| 1518 intptr_t rodata_blob_size = 0; | 1531 &vm_data_buffer, &vm_data_size, &vm_instructions_buffer, |
| 1519 Dart_Handle result; | 1532 &vm_instructions_size, &isolate_data_buffer, &isolate_data_size, |
| 1520 if (use_blobs) { | 1533 &isolate_instructions_buffer, &isolate_instructions_size); |
| 1521 result = Dart_CreateAppAOTSnapshotAsBlobs( | |
| 1522 &vm_isolate_buffer, &vm_isolate_size, &isolate_buffer, &isolate_size, | |
| 1523 &instructions_blob_buffer, &instructions_blob_size, &rodata_blob_buffer, | |
| 1524 &rodata_blob_size); | |
| 1525 } else { | |
| 1526 result = | |
| 1527 Dart_CreateAppAOTSnapshotAsAssembly(&assembly_buffer, &assembly_size); | |
| 1528 } | |
| 1529 if (Dart_IsError(result)) { | 1534 if (Dart_IsError(result)) { |
| 1530 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); | 1535 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
| 1531 } | 1536 } |
| 1537 WriteAppSnapshot(snapshot_filename, vm_data_buffer, vm_data_size, |
| 1538 vm_instructions_buffer, vm_instructions_size, |
| 1539 isolate_data_buffer, isolate_data_size, |
| 1540 isolate_instructions_buffer, isolate_instructions_size); |
| 1541 } |
| 1542 |
| 1543 static void GenerateAppAOTSnapshotAsAssembly() { |
| 1544 uint8_t* assembly_buffer = NULL; |
| 1545 intptr_t assembly_size = 0; |
| 1546 Dart_Handle result = |
| 1547 Dart_CreateAppAOTSnapshotAsAssembly(&assembly_buffer, &assembly_size); |
| 1548 if (Dart_IsError(result)) { |
| 1549 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
| 1550 } |
| 1551 WriteSnapshotFile(snapshot_filename, false, assembly_buffer, assembly_size); |
| 1552 } |
| 1553 |
| 1554 |
| 1555 static void GenerateAppAOTSnapshot() { |
| 1532 if (use_blobs) { | 1556 if (use_blobs) { |
| 1533 WriteAppSnapshot(snapshot_filename, vm_isolate_buffer, vm_isolate_size, | 1557 GenerateAppAOTSnapshotAsBlobs(); |
| 1534 isolate_buffer, isolate_size, instructions_blob_buffer, | |
| 1535 instructions_blob_size, rodata_blob_buffer, | |
| 1536 rodata_blob_size); | |
| 1537 } else { | 1558 } else { |
| 1538 WriteSnapshotFile(snapshot_filename, false, assembly_buffer, assembly_size); | 1559 GenerateAppAOTSnapshotAsAssembly(); |
| 1539 } | 1560 } |
| 1540 } | 1561 } |
| 1541 | 1562 |
| 1542 | 1563 |
| 1543 static void GenerateAppJITSnapshot() { | 1564 static void GenerateAppJITSnapshot() { |
| 1544 #if defined(TARGET_ARCH_X64) | 1565 #if defined(TARGET_ARCH_X64) |
| 1545 uint8_t* vm_isolate_buffer = NULL; | 1566 uint8_t* isolate_data_buffer = NULL; |
| 1546 intptr_t vm_isolate_size = 0; | 1567 intptr_t isolate_data_size = 0; |
| 1547 uint8_t* isolate_buffer = NULL; | 1568 uint8_t* isolate_instructions_buffer = NULL; |
| 1548 intptr_t isolate_size = 0; | 1569 intptr_t isolate_instructions_size = 0; |
| 1549 uint8_t* instructions_blob_buffer = NULL; | |
| 1550 intptr_t instructions_blob_size = 0; | |
| 1551 uint8_t* rodata_blob_buffer = NULL; | |
| 1552 intptr_t rodata_blob_size = 0; | |
| 1553 Dart_Handle result = Dart_CreateAppJITSnapshotAsBlobs( | 1570 Dart_Handle result = Dart_CreateAppJITSnapshotAsBlobs( |
| 1554 &isolate_buffer, &isolate_size, &instructions_blob_buffer, | 1571 &isolate_data_buffer, &isolate_data_size, &isolate_instructions_buffer, |
| 1555 &instructions_blob_size, &rodata_blob_buffer, &rodata_blob_size); | 1572 &isolate_instructions_size); |
| 1556 if (Dart_IsError(result)) { | 1573 if (Dart_IsError(result)) { |
| 1557 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); | 1574 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
| 1558 } | 1575 } |
| 1559 WriteAppSnapshot(snapshot_filename, vm_isolate_buffer, vm_isolate_size, | 1576 WriteAppSnapshot(snapshot_filename, NULL, 0, NULL, 0, isolate_data_buffer, |
| 1560 isolate_buffer, isolate_size, instructions_blob_buffer, | 1577 isolate_data_size, isolate_instructions_buffer, |
| 1561 instructions_blob_size, rodata_blob_buffer, | 1578 isolate_instructions_size); |
| 1562 rodata_blob_size); | |
| 1563 #else | 1579 #else |
| 1564 uint8_t* isolate_buffer = NULL; | 1580 uint8_t* isolate_buffer = NULL; |
| 1565 intptr_t isolate_size = 0; | 1581 intptr_t isolate_size = 0; |
| 1566 | 1582 |
| 1567 Dart_Handle result = | 1583 Dart_Handle result = |
| 1568 Dart_CreateSnapshot(NULL, NULL, &isolate_buffer, &isolate_size); | 1584 Dart_CreateSnapshot(NULL, NULL, &isolate_buffer, &isolate_size); |
| 1569 if (Dart_IsError(result)) { | 1585 if (Dart_IsError(result)) { |
| 1570 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); | 1586 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
| 1571 } | 1587 } |
| 1572 | 1588 |
| 1573 WriteAppSnapshot(snapshot_filename, NULL, 0, isolate_buffer, isolate_size, | 1589 WriteAppSnapshot(snapshot_filename, NULL, 0, NULL, 0, isolate_buffer, |
| 1574 NULL, 0, NULL, 0); | 1590 isolate_size, NULL, 0); |
| 1575 #endif // defined(TARGET_ARCH_X64) | 1591 #endif // defined(TARGET_ARCH_X64) |
| 1576 } | 1592 } |
| 1577 | 1593 |
| 1578 | 1594 |
| 1579 #define CHECK_RESULT(result) \ | 1595 #define CHECK_RESULT(result) \ |
| 1580 if (Dart_IsError(result)) { \ | 1596 if (Dart_IsError(result)) { \ |
| 1581 if (Dart_IsVMRestartRequest(result)) { \ | 1597 if (Dart_IsVMRestartRequest(result)) { \ |
| 1582 Dart_ExitScope(); \ | 1598 Dart_ExitScope(); \ |
| 1583 Dart_ShutdownIsolate(); \ | 1599 Dart_ShutdownIsolate(); \ |
| 1584 return true; \ | 1600 return true; \ |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 | 1748 |
| 1733 result = Dart_Precompile(standalone_entry_points, feedback_buffer, | 1749 result = Dart_Precompile(standalone_entry_points, feedback_buffer, |
| 1734 feedback_length); | 1750 feedback_length); |
| 1735 if (feedback_buffer != NULL) { | 1751 if (feedback_buffer != NULL) { |
| 1736 free(feedback_buffer); | 1752 free(feedback_buffer); |
| 1737 } | 1753 } |
| 1738 CHECK_RESULT(result); | 1754 CHECK_RESULT(result); |
| 1739 } | 1755 } |
| 1740 | 1756 |
| 1741 if (gen_snapshot_kind == kAppAOT) { | 1757 if (gen_snapshot_kind == kAppAOT) { |
| 1742 GeneratePrecompiledSnapshot(); | 1758 GenerateAppAOTSnapshot(); |
| 1743 } else { | 1759 } else { |
| 1744 if (Dart_IsNull(root_lib)) { | 1760 if (Dart_IsNull(root_lib)) { |
| 1745 ErrorExit(kErrorExitCode, "Unable to find root library for '%s'\n", | 1761 ErrorExit(kErrorExitCode, "Unable to find root library for '%s'\n", |
| 1746 script_name); | 1762 script_name); |
| 1747 } | 1763 } |
| 1748 | 1764 |
| 1749 // The helper function _getMainClosure creates a closure for the main | 1765 // The helper function _getMainClosure creates a closure for the main |
| 1750 // entry point which is either explicitly or implictly exported from the | 1766 // entry point which is either explicitly or implictly exported from the |
| 1751 // root library. | 1767 // root library. |
| 1752 Dart_Handle main_closure = | 1768 Dart_Handle main_closure = |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 Thread::InitOnce(); | 1946 Thread::InitOnce(); |
| 1931 | 1947 |
| 1932 Loader::InitOnce(); | 1948 Loader::InitOnce(); |
| 1933 | 1949 |
| 1934 if (!DartUtils::SetOriginalWorkingDirectory()) { | 1950 if (!DartUtils::SetOriginalWorkingDirectory()) { |
| 1935 OSError err; | 1951 OSError err; |
| 1936 Log::PrintErr("Error determining current directory: %s\n", err.message()); | 1952 Log::PrintErr("Error determining current directory: %s\n", err.message()); |
| 1937 Platform::Exit(kErrorExitCode); | 1953 Platform::Exit(kErrorExitCode); |
| 1938 } | 1954 } |
| 1939 | 1955 |
| 1940 const uint8_t* instructions_snapshot = NULL; | 1956 if (ReadAppSnapshot(script_name, &vm_snapshot_data, &vm_snapshot_instructions, |
| 1941 const uint8_t* data_snapshot = NULL; | 1957 &app_isolate_snapshot_data, |
| 1942 if (ReadAppSnapshot(script_name, &vm_isolate_snapshot_buffer, | 1958 &app_isolate_snapshot_instructions)) { |
| 1943 &app_isolate_snapshot_buffer, &instructions_snapshot, | |
| 1944 &data_snapshot)) { | |
| 1945 vm_run_app_snapshot = true; | 1959 vm_run_app_snapshot = true; |
| 1946 } | 1960 } |
| 1947 | 1961 |
| 1948 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) | 1962 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1949 // Constant true if PRODUCT or DART_PRECOMPILED_RUNTIME. | 1963 // Constant true if PRODUCT or DART_PRECOMPILED_RUNTIME. |
| 1950 if ((gen_snapshot_kind != kNone) || vm_run_app_snapshot) { | 1964 if ((gen_snapshot_kind != kNone) || vm_run_app_snapshot) { |
| 1951 vm_options.AddArgument("--load_deferred_eagerly"); | 1965 vm_options.AddArgument("--load_deferred_eagerly"); |
| 1952 } | 1966 } |
| 1953 #endif | 1967 #endif |
| 1954 | 1968 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1971 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 1985 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 1972 | 1986 |
| 1973 // Start event handler. | 1987 // Start event handler. |
| 1974 TimerUtils::InitOnce(); | 1988 TimerUtils::InitOnce(); |
| 1975 EventHandler::Start(); | 1989 EventHandler::Start(); |
| 1976 | 1990 |
| 1977 // Initialize the Dart VM. | 1991 // Initialize the Dart VM. |
| 1978 Dart_InitializeParams init_params; | 1992 Dart_InitializeParams init_params; |
| 1979 memset(&init_params, 0, sizeof(init_params)); | 1993 memset(&init_params, 0, sizeof(init_params)); |
| 1980 init_params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; | 1994 init_params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; |
| 1981 init_params.vm_isolate_snapshot = vm_isolate_snapshot_buffer; | 1995 init_params.vm_snapshot_data = vm_snapshot_data; |
| 1982 init_params.instructions_snapshot = instructions_snapshot; | 1996 init_params.vm_snapshot_instructions = vm_snapshot_instructions; |
| 1983 init_params.data_snapshot = data_snapshot; | |
| 1984 init_params.create = CreateIsolateAndSetup; | 1997 init_params.create = CreateIsolateAndSetup; |
| 1985 init_params.shutdown = ShutdownIsolate; | 1998 init_params.shutdown = ShutdownIsolate; |
| 1986 init_params.file_open = DartUtils::OpenFile; | 1999 init_params.file_open = DartUtils::OpenFile; |
| 1987 init_params.file_read = DartUtils::ReadFile; | 2000 init_params.file_read = DartUtils::ReadFile; |
| 1988 init_params.file_write = DartUtils::WriteFile; | 2001 init_params.file_write = DartUtils::WriteFile; |
| 1989 init_params.file_close = DartUtils::CloseFile; | 2002 init_params.file_close = DartUtils::CloseFile; |
| 1990 init_params.entropy_source = DartUtils::EntropySource; | 2003 init_params.entropy_source = DartUtils::EntropySource; |
| 1991 init_params.get_service_assets = GetVMServiceAssetsArchiveCallback; | 2004 init_params.get_service_assets = GetVMServiceAssetsArchiveCallback; |
| 1992 | 2005 |
| 1993 char* error = Dart_Initialize(&init_params); | 2006 char* error = Dart_Initialize(&init_params); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 Platform::Exit(Process::GlobalExitCode()); | 2054 Platform::Exit(Process::GlobalExitCode()); |
| 2042 } | 2055 } |
| 2043 | 2056 |
| 2044 } // namespace bin | 2057 } // namespace bin |
| 2045 } // namespace dart | 2058 } // namespace dart |
| 2046 | 2059 |
| 2047 int main(int argc, char** argv) { | 2060 int main(int argc, char** argv) { |
| 2048 dart::bin::main(argc, argv); | 2061 dart::bin::main(argc, argv); |
| 2049 UNREACHABLE(); | 2062 UNREACHABLE(); |
| 2050 } | 2063 } |
| OLD | NEW |