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 26 matching lines...) Expand all Loading... |
37 // vm_isolate_snapshot_buffer points to a snapshot for the vm isolate if we | 37 // vm_isolate_snapshot_buffer points to a snapshot for the vm isolate if we |
38 // link in a snapshot otherwise it is initialized to NULL. | 38 // link in a snapshot otherwise it is initialized to NULL. |
39 extern const uint8_t* vm_isolate_snapshot_buffer; | 39 extern const uint8_t* vm_isolate_snapshot_buffer; |
40 | 40 |
41 // isolate_snapshot_buffer points to a snapshot for an isolate if we link in a | 41 // isolate_snapshot_buffer points to a snapshot for an isolate if we link in a |
42 // snapshot otherwise it is initialized to NULL. | 42 // snapshot otherwise it is initialized to NULL. |
43 extern const uint8_t* isolate_snapshot_buffer; | 43 extern const uint8_t* isolate_snapshot_buffer; |
44 | 44 |
45 /** | 45 /** |
46 * Global state used to control and store generation of application snapshots | 46 * Global state used to control and store generation of application snapshots |
47 * (script/full). | 47 * An application snapshot can be generated and run using the following |
48 * A full application snapshot can be generated and run using the following | 48 * command |
49 * commands | 49 * dart --snapshot-kind=app-jit --snapshot=<app_snapshot_filename> |
50 * - Generating a full application snapshot : | 50 * <script_uri> [<script_options>] |
51 * dart_bootstrap --full-snapshot-after-run=<filename> --package-root=<dirs> | 51 * To Run the application snapshot generated above, use : |
52 * <script_uri> [<script_options>] | 52 * dart <app_snapshot_filename> [<script_options>] |
53 * - Running the full application snapshot generated above : | |
54 * dart --run-full-snapshot=<filename> <script_uri> [<script_options>] | |
55 */ | 53 */ |
56 static bool run_app_snapshot = false; | 54 static bool run_app_snapshot = false; |
57 static const char* snapshot_filename = NULL; | 55 static const char* snapshot_filename = NULL; |
58 enum SnapshotKind { | 56 enum SnapshotKind { |
59 kNone, | 57 kNone, |
60 kScript, | 58 kScript, |
61 kAppAOT, | 59 kAppAOT, |
62 kAppJITAfterRun, | 60 kAppJIT, |
63 kAppAfterRun, | |
64 }; | 61 }; |
65 static SnapshotKind gen_snapshot_kind = kNone; | 62 static SnapshotKind gen_snapshot_kind = kNone; |
66 | 63 |
67 // Value of the --package-root flag. | 64 // Value of the --package-root flag. |
68 // (This pointer points into an argv buffer and does not need to be | 65 // (This pointer points into an argv buffer and does not need to be |
69 // free'd.) | 66 // free'd.) |
70 static const char* commandline_package_root = NULL; | 67 static const char* commandline_package_root = NULL; |
71 | 68 |
72 // Value of the --packages flag. | 69 // Value of the --packages flag. |
73 // (This pointer points into an argv buffer and does not need to be | 70 // (This pointer points into an argv buffer and does not need to be |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 350 |
354 | 351 |
355 static bool ProcessSnapshotKindOption(const char* kind, | 352 static bool ProcessSnapshotKindOption(const char* kind, |
356 CommandLineOptions* vm_options) { | 353 CommandLineOptions* vm_options) { |
357 if (strcmp(kind, "script") == 0) { | 354 if (strcmp(kind, "script") == 0) { |
358 gen_snapshot_kind = kScript; | 355 gen_snapshot_kind = kScript; |
359 return true; | 356 return true; |
360 } else if (strcmp(kind, "app-aot") == 0) { | 357 } else if (strcmp(kind, "app-aot") == 0) { |
361 gen_snapshot_kind = kAppAOT; | 358 gen_snapshot_kind = kAppAOT; |
362 return true; | 359 return true; |
363 } else if (strcmp(kind, "app-jit-after-run") == 0) { | 360 } else if (strcmp(kind, "app-jit") == 0) { |
364 gen_snapshot_kind = kAppJITAfterRun; | 361 gen_snapshot_kind = kAppJIT; |
365 return true; | |
366 } else if (strcmp(kind, "app-after-run") == 0) { | |
367 gen_snapshot_kind = kAppAfterRun; | |
368 return true; | 362 return true; |
369 } | 363 } |
370 Log::PrintErr("Unrecognized snapshot kind: '%s'\nValid kinds are: " | 364 Log::PrintErr("Unrecognized snapshot kind: '%s'\nValid kinds are: " |
371 "script, app-aot, app-jit-after-run, app-after-run\n", kind); | 365 "script, app-aot, app-jit\n", kind); |
372 return false; | 366 return false; |
373 } | 367 } |
374 | 368 |
375 | 369 |
376 static bool ProcessEnableVmServiceOption(const char* option_value, | 370 static bool ProcessEnableVmServiceOption(const char* option_value, |
377 CommandLineOptions* vm_options) { | 371 CommandLineOptions* vm_options) { |
378 ASSERT(option_value != NULL); | 372 ASSERT(option_value != NULL); |
379 | 373 |
380 if (!ExtractPortAndIP(option_value, | 374 if (!ExtractPortAndIP(option_value, |
381 &vm_service_server_port, | 375 &vm_service_server_port, |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 const bool run_service_isolate = true; | 791 const bool run_service_isolate = true; |
798 #endif // PRODUCT | 792 #endif // PRODUCT |
799 if (!run_service_isolate && | 793 if (!run_service_isolate && |
800 (strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0)) { | 794 (strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0)) { |
801 return NULL; | 795 return NULL; |
802 } | 796 } |
803 | 797 |
804 IsolateData* isolate_data = new IsolateData(script_uri, | 798 IsolateData* isolate_data = new IsolateData(script_uri, |
805 package_root, | 799 package_root, |
806 packages_config); | 800 packages_config); |
807 if ((gen_snapshot_kind == kAppAfterRun) || | 801 if (gen_snapshot_kind == kAppJIT) { |
808 (gen_snapshot_kind == kAppJITAfterRun)) { | |
809 isolate_data->set_exit_hook(SnapshotOnExitHook); | 802 isolate_data->set_exit_hook(SnapshotOnExitHook); |
810 } | 803 } |
811 Dart_Isolate isolate = Dart_CreateIsolate(script_uri, | 804 Dart_Isolate isolate = Dart_CreateIsolate(script_uri, |
812 main, | 805 main, |
813 isolate_snapshot_buffer, | 806 isolate_snapshot_buffer, |
814 flags, | 807 flags, |
815 isolate_data, | 808 isolate_data, |
816 error); | 809 error); |
817 if (isolate == NULL) { | 810 if (isolate == NULL) { |
818 delete isolate_data; | 811 delete isolate_data; |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 int64_t data[File::kStatSize]; | 1145 int64_t data[File::kStatSize]; |
1153 File::Stat(url + 7, data); | 1146 File::Stat(url + 7, data); |
1154 if (data[File::kType] == File::kDoesNotExist) { | 1147 if (data[File::kType] == File::kDoesNotExist) { |
1155 return true; | 1148 return true; |
1156 } | 1149 } |
1157 bool modified = data[File::kModifiedTime] > since; | 1150 bool modified = data[File::kModifiedTime] > since; |
1158 return modified; | 1151 return modified; |
1159 } | 1152 } |
1160 | 1153 |
1161 | 1154 |
1162 static void WriteSnapshotFile(const char* snapshot_directory, | 1155 static void WriteSnapshotFile(const char* filename, |
1163 const char* filename, | |
1164 bool write_magic_number, | 1156 bool write_magic_number, |
1165 const uint8_t* buffer, | 1157 const uint8_t* buffer, |
1166 const intptr_t size) { | 1158 const intptr_t size) { |
1167 char* concat = NULL; | 1159 char* concat = NULL; |
1168 const char* qualified_filename; | 1160 File* file = File::Open(filename, File::kWriteTruncate); |
1169 if ((snapshot_directory != NULL) && (strlen(snapshot_directory) > 0)) { | |
1170 intptr_t len = snprintf(NULL, 0, "%s/%s", snapshot_directory, filename); | |
1171 concat = new char[len + 1]; | |
1172 snprintf(concat, len + 1, "%s/%s", snapshot_directory, filename); | |
1173 qualified_filename = concat; | |
1174 } else { | |
1175 qualified_filename = filename; | |
1176 } | |
1177 | |
1178 File* file = File::Open(qualified_filename, File::kWriteTruncate); | |
1179 if (file == NULL) { | 1161 if (file == NULL) { |
1180 ErrorExit(kErrorExitCode, | 1162 ErrorExit(kErrorExitCode, |
1181 "Unable to open file %s for writing snapshot\n", | 1163 "Unable to open file %s for writing snapshot\n", |
1182 qualified_filename); | 1164 filename); |
1183 } | 1165 } |
1184 | 1166 |
1185 if (write_magic_number) { | 1167 if (write_magic_number) { |
1186 // Write the magic number to indicate file is a script snapshot. | 1168 // Write the magic number to indicate file is a script snapshot. |
1187 DartUtils::WriteMagicNumber(file); | 1169 DartUtils::WriteMagicNumber(file); |
1188 } | 1170 } |
1189 | 1171 |
1190 if (!file->WriteFully(buffer, size)) { | 1172 if (!file->WriteFully(buffer, size)) { |
1191 ErrorExit(kErrorExitCode, | 1173 ErrorExit(kErrorExitCode, |
1192 "Unable to write file %s for writing snapshot\n", | 1174 "Unable to write file %s for writing snapshot\n", |
1193 qualified_filename); | 1175 filename); |
1194 } | 1176 } |
1195 file->Release(); | 1177 file->Release(); |
1196 if (concat != NULL) { | 1178 if (concat != NULL) { |
1197 delete concat; | 1179 delete concat; |
1198 } | 1180 } |
1199 } | 1181 } |
1200 | 1182 |
1201 | 1183 |
1202 static const int64_t kAppSnapshotHeaderSize = 5 * sizeof(int64_t); // NOLINT | 1184 static const int64_t kAppSnapshotHeaderSize = 5 * sizeof(int64_t); // NOLINT |
1203 static const int64_t kAppSnapshotMagicNumber = 0xf6f6dcdc; | 1185 static const int64_t kAppSnapshotMagicNumber = 0xf6f6dcdc; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 | 1379 |
1398 static void GenerateScriptSnapshot() { | 1380 static void GenerateScriptSnapshot() { |
1399 // First create a snapshot. | 1381 // First create a snapshot. |
1400 uint8_t* buffer = NULL; | 1382 uint8_t* buffer = NULL; |
1401 intptr_t size = 0; | 1383 intptr_t size = 0; |
1402 Dart_Handle result = Dart_CreateScriptSnapshot(&buffer, &size); | 1384 Dart_Handle result = Dart_CreateScriptSnapshot(&buffer, &size); |
1403 if (Dart_IsError(result)) { | 1385 if (Dart_IsError(result)) { |
1404 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); | 1386 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
1405 } | 1387 } |
1406 | 1388 |
1407 WriteSnapshotFile(NULL, snapshot_filename, true, buffer, size); | 1389 WriteSnapshotFile(snapshot_filename, true, buffer, size); |
1408 } | 1390 } |
1409 | 1391 |
1410 | 1392 |
1411 static void GeneratePrecompiledSnapshot() { | 1393 static void GeneratePrecompiledSnapshot() { |
1412 uint8_t* vm_isolate_buffer = NULL; | 1394 uint8_t* vm_isolate_buffer = NULL; |
1413 intptr_t vm_isolate_size = 0; | 1395 intptr_t vm_isolate_size = 0; |
1414 uint8_t* isolate_buffer = NULL; | 1396 uint8_t* isolate_buffer = NULL; |
1415 intptr_t isolate_size = 0; | 1397 intptr_t isolate_size = 0; |
1416 uint8_t* assembly_buffer = NULL; | 1398 uint8_t* assembly_buffer = NULL; |
1417 intptr_t assembly_size = 0; | 1399 intptr_t assembly_size = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
1442 WriteAppSnapshot(snapshot_filename, | 1424 WriteAppSnapshot(snapshot_filename, |
1443 vm_isolate_buffer, | 1425 vm_isolate_buffer, |
1444 vm_isolate_size, | 1426 vm_isolate_size, |
1445 isolate_buffer, | 1427 isolate_buffer, |
1446 isolate_size, | 1428 isolate_size, |
1447 instructions_blob_buffer, | 1429 instructions_blob_buffer, |
1448 instructions_blob_size, | 1430 instructions_blob_size, |
1449 rodata_blob_buffer, | 1431 rodata_blob_buffer, |
1450 rodata_blob_size); | 1432 rodata_blob_size); |
1451 } else { | 1433 } else { |
1452 WriteSnapshotFile(NULL, snapshot_filename, | 1434 WriteSnapshotFile(snapshot_filename, |
1453 false, | 1435 false, |
1454 assembly_buffer, | 1436 assembly_buffer, |
1455 assembly_size); | 1437 assembly_size); |
1456 } | 1438 } |
1457 } | 1439 } |
1458 | 1440 |
1459 | 1441 |
1460 static void GeneratePrecompiledJITSnapshot() { | 1442 static void GeneratePrecompiledJITSnapshot() { |
1461 uint8_t* vm_isolate_buffer = NULL; | 1443 uint8_t* vm_isolate_buffer = NULL; |
1462 intptr_t vm_isolate_size = 0; | 1444 intptr_t vm_isolate_size = 0; |
(...skipping 20 matching lines...) Expand all Loading... |
1483 vm_isolate_size, | 1465 vm_isolate_size, |
1484 isolate_buffer, | 1466 isolate_buffer, |
1485 isolate_size, | 1467 isolate_size, |
1486 instructions_blob_buffer, | 1468 instructions_blob_buffer, |
1487 instructions_blob_size, | 1469 instructions_blob_size, |
1488 rodata_blob_buffer, | 1470 rodata_blob_buffer, |
1489 rodata_blob_size); | 1471 rodata_blob_size); |
1490 } | 1472 } |
1491 | 1473 |
1492 | 1474 |
1493 static void GenerateFullSnapshot() { | 1475 static void GenerateAppSnapshot() { |
1494 // Create a full snapshot of the script. | |
1495 Dart_Handle result; | 1476 Dart_Handle result; |
| 1477 #if defined(TARGET_ARCH_X64) |
| 1478 result = Dart_PrecompileJIT(); |
| 1479 if (Dart_IsError(result)) { |
| 1480 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
| 1481 } |
| 1482 GeneratePrecompiledJITSnapshot(); |
| 1483 #else |
| 1484 // Create an application snapshot of the script. |
1496 uint8_t* vm_isolate_buffer = NULL; | 1485 uint8_t* vm_isolate_buffer = NULL; |
1497 intptr_t vm_isolate_size = 0; | 1486 intptr_t vm_isolate_size = 0; |
1498 uint8_t* isolate_buffer = NULL; | 1487 uint8_t* isolate_buffer = NULL; |
1499 intptr_t isolate_size = 0; | 1488 intptr_t isolate_size = 0; |
1500 | 1489 |
1501 result = Dart_CreateSnapshot(&vm_isolate_buffer, | 1490 result = Dart_CreateSnapshot(&vm_isolate_buffer, |
1502 &vm_isolate_size, | 1491 &vm_isolate_size, |
1503 &isolate_buffer, | 1492 &isolate_buffer, |
1504 &isolate_size); | 1493 &isolate_size); |
1505 if (Dart_IsError(result)) { | 1494 if (Dart_IsError(result)) { |
1506 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); | 1495 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
1507 } | 1496 } |
1508 | 1497 |
1509 WriteAppSnapshot(snapshot_filename, | 1498 WriteAppSnapshot(snapshot_filename, |
1510 vm_isolate_buffer, | 1499 vm_isolate_buffer, |
1511 vm_isolate_size, | 1500 vm_isolate_size, |
1512 isolate_buffer, | 1501 isolate_buffer, |
1513 isolate_size, | 1502 isolate_size, |
1514 NULL, 0, NULL, 0); | 1503 NULL, 0, NULL, 0); |
| 1504 #endif // defined(TARGET_ARCH_X64) |
1515 } | 1505 } |
1516 | 1506 |
1517 | 1507 |
| 1508 |
1518 #define CHECK_RESULT(result) \ | 1509 #define CHECK_RESULT(result) \ |
1519 if (Dart_IsError(result)) { \ | 1510 if (Dart_IsError(result)) { \ |
1520 if (Dart_IsVMRestartRequest(result)) { \ | 1511 if (Dart_IsVMRestartRequest(result)) { \ |
1521 Dart_ExitScope(); \ | 1512 Dart_ExitScope(); \ |
1522 Dart_ShutdownIsolate(); \ | 1513 Dart_ShutdownIsolate(); \ |
1523 return true; \ | 1514 return true; \ |
1524 } \ | 1515 } \ |
1525 const int exit_code = Dart_IsCompilationError(result) ? \ | 1516 const int exit_code = Dart_IsCompilationError(result) ? \ |
1526 kCompilationErrorExitCode : kErrorExitCode; \ | 1517 kCompilationErrorExitCode : kErrorExitCode; \ |
1527 ErrorExit(exit_code, "%s\n", Dart_GetError(result)); \ | 1518 ErrorExit(exit_code, "%s\n", Dart_GetError(result)); \ |
1528 } | 1519 } |
1529 | 1520 |
1530 | 1521 |
1531 static void SnapshotOnExitHook(int64_t exit_code) { | 1522 static void SnapshotOnExitHook(int64_t exit_code) { |
1532 if (exit_code == 0) { | 1523 if (exit_code == 0) { |
1533 if (gen_snapshot_kind == kAppAfterRun) { | 1524 GenerateAppSnapshot(); |
1534 GenerateFullSnapshot(); | |
1535 } else { | |
1536 Dart_PrecompileJIT(); | |
1537 GeneratePrecompiledJITSnapshot(); | |
1538 } | |
1539 } | 1525 } |
1540 } | 1526 } |
1541 | 1527 |
1542 | 1528 |
1543 bool RunMainIsolate(const char* script_name, | 1529 bool RunMainIsolate(const char* script_name, |
1544 CommandLineOptions* dart_options) { | 1530 CommandLineOptions* dart_options) { |
1545 // Call CreateIsolateAndSetup which creates an isolate and loads up | 1531 // Call CreateIsolateAndSetup which creates an isolate and loads up |
1546 // the specified application script. | 1532 // the specified application script. |
1547 char* error = NULL; | 1533 char* error = NULL; |
1548 int exit_code = 0; | 1534 int exit_code = 0; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 } else { | 1572 } else { |
1587 // Lookup the library of the root script. | 1573 // Lookup the library of the root script. |
1588 Dart_Handle root_lib = Dart_RootLibrary(); | 1574 Dart_Handle root_lib = Dart_RootLibrary(); |
1589 // Import the root library into the builtin library so that we can easily | 1575 // Import the root library into the builtin library so that we can easily |
1590 // lookup the main entry point exported from the root library. | 1576 // lookup the main entry point exported from the root library. |
1591 IsolateData* isolate_data = | 1577 IsolateData* isolate_data = |
1592 reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate)); | 1578 reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate)); |
1593 result = Dart_LibraryImportLibrary( | 1579 result = Dart_LibraryImportLibrary( |
1594 isolate_data->builtin_lib(), root_lib, Dart_Null()); | 1580 isolate_data->builtin_lib(), root_lib, Dart_Null()); |
1595 if (is_noopt || | 1581 if (is_noopt || |
1596 (gen_snapshot_kind == kAppAfterRun) || | |
1597 (gen_snapshot_kind == kAppAOT) || | 1582 (gen_snapshot_kind == kAppAOT) || |
1598 (gen_snapshot_kind == kAppJITAfterRun)) { | 1583 (gen_snapshot_kind == kAppJIT)) { |
1599 // Load the embedder's portion of the VM service's Dart code so it will | 1584 // Load the embedder's portion of the VM service's Dart code so it will |
1600 // be included in the app snapshot. | 1585 // be included in the app snapshot. |
1601 if (!VmService::LoadForGenPrecompiled()) { | 1586 if (!VmService::LoadForGenPrecompiled()) { |
1602 fprintf(stderr, | 1587 fprintf(stderr, |
1603 "VM service loading failed: %s\n", | 1588 "VM service loading failed: %s\n", |
1604 VmService::GetErrorMessage()); | 1589 VmService::GetErrorMessage()); |
1605 fflush(stderr); | 1590 fflush(stderr); |
1606 exit(kErrorExitCode); | 1591 exit(kErrorExitCode); |
1607 } | 1592 } |
1608 } | 1593 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 Dart_Handle isolate_lib = | 1675 Dart_Handle isolate_lib = |
1691 Dart_LookupLibrary(Dart_NewStringFromCString("dart:isolate")); | 1676 Dart_LookupLibrary(Dart_NewStringFromCString("dart:isolate")); |
1692 result = Dart_Invoke(isolate_lib, | 1677 result = Dart_Invoke(isolate_lib, |
1693 Dart_NewStringFromCString("_startMainIsolate"), | 1678 Dart_NewStringFromCString("_startMainIsolate"), |
1694 kNumIsolateArgs, isolate_args); | 1679 kNumIsolateArgs, isolate_args); |
1695 CHECK_RESULT(result); | 1680 CHECK_RESULT(result); |
1696 | 1681 |
1697 // Keep handling messages until the last active receive port is closed. | 1682 // Keep handling messages until the last active receive port is closed. |
1698 result = Dart_RunLoop(); | 1683 result = Dart_RunLoop(); |
1699 // Generate an app snapshot after execution if specified. | 1684 // Generate an app snapshot after execution if specified. |
1700 if ((gen_snapshot_kind == kAppAfterRun) || | 1685 if ((gen_snapshot_kind == kAppJIT)) { |
1701 (gen_snapshot_kind == kAppJITAfterRun)) { | |
1702 if (!Dart_IsCompilationError(result) && | 1686 if (!Dart_IsCompilationError(result) && |
1703 !Dart_IsVMRestartRequest(result)) { | 1687 !Dart_IsVMRestartRequest(result)) { |
1704 if (gen_snapshot_kind == kAppAfterRun) { | 1688 GenerateAppSnapshot(); |
1705 GenerateFullSnapshot(); | |
1706 } else { | |
1707 Dart_Handle prepare_result = Dart_PrecompileJIT(); | |
1708 CHECK_RESULT(prepare_result); | |
1709 GeneratePrecompiledJITSnapshot(); | |
1710 } | |
1711 } | 1689 } |
1712 } | 1690 } |
1713 CHECK_RESULT(result); | 1691 CHECK_RESULT(result); |
1714 } | 1692 } |
1715 } | 1693 } |
1716 | 1694 |
1717 Dart_ExitScope(); | 1695 Dart_ExitScope(); |
1718 // Shutdown the isolate. | 1696 // Shutdown the isolate. |
1719 Dart_ShutdownIsolate(); | 1697 Dart_ShutdownIsolate(); |
1720 | 1698 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 run_app_snapshot = true; | 1856 run_app_snapshot = true; |
1879 } | 1857 } |
1880 | 1858 |
1881 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) | 1859 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
1882 // Constant true if PRODUCT or DART_PRECOMPILED_RUNTIME. | 1860 // Constant true if PRODUCT or DART_PRECOMPILED_RUNTIME. |
1883 if ((gen_snapshot_kind != kNone) || run_app_snapshot) { | 1861 if ((gen_snapshot_kind != kNone) || run_app_snapshot) { |
1884 vm_options.AddArgument("--load_deferred_eagerly"); | 1862 vm_options.AddArgument("--load_deferred_eagerly"); |
1885 } | 1863 } |
1886 #endif | 1864 #endif |
1887 | 1865 |
1888 if (gen_snapshot_kind == kAppJITAfterRun) { | 1866 if (gen_snapshot_kind == kAppJIT) { |
1889 vm_options.AddArgument("--fields_may_be_reset"); | 1867 vm_options.AddArgument("--fields_may_be_reset"); |
1890 } | 1868 } |
1891 if ((gen_snapshot_kind == kAppAOT) || is_noopt) { | 1869 if ((gen_snapshot_kind == kAppAOT) || is_noopt) { |
1892 vm_options.AddArgument("--precompilation"); | 1870 vm_options.AddArgument("--precompilation"); |
1893 } | 1871 } |
1894 #if defined(DART_PRECOMPILED_RUNTIME) | 1872 #if defined(DART_PRECOMPILED_RUNTIME) |
1895 vm_options.AddArgument("--precompilation"); | 1873 vm_options.AddArgument("--precompilation"); |
1896 #endif | 1874 #endif |
1897 | 1875 |
1898 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 1876 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 Platform::Exit(Process::GlobalExitCode()); | 1946 Platform::Exit(Process::GlobalExitCode()); |
1969 } | 1947 } |
1970 | 1948 |
1971 } // namespace bin | 1949 } // namespace bin |
1972 } // namespace dart | 1950 } // namespace dart |
1973 | 1951 |
1974 int main(int argc, char** argv) { | 1952 int main(int argc, char** argv) { |
1975 dart::bin::main(argc, argv); | 1953 dart::bin::main(argc, argv); |
1976 UNREACHABLE(); | 1954 UNREACHABLE(); |
1977 } | 1955 } |
OLD | NEW |