| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 // Value of the --packages flag. | 72 // Value of the --packages flag. |
| 73 // (This pointer points into an argv buffer and does not need to be | 73 // (This pointer points into an argv buffer and does not need to be |
| 74 // free'd.) | 74 // free'd.) |
| 75 static const char* commandline_packages_file = NULL; | 75 static const char* commandline_packages_file = NULL; |
| 76 | 76 |
| 77 | 77 |
| 78 // Global flag that is used to indicate that we want to compile all the | 78 // Global flag that is used to indicate that we want to compile all the |
| 79 // dart functions and not run anything. | 79 // dart functions and not run anything. |
| 80 static bool compile_all = false; | 80 static bool compile_all = false; |
| 81 static bool parse_all = false; |
| 81 | 82 |
| 82 | 83 |
| 83 // Global flag that is used to indicate that we want to use blobs/mmap instead | 84 // Global flag that is used to indicate that we want to use blobs/mmap instead |
| 84 // of assembly/shared libraries for precompilation. | 85 // of assembly/shared libraries for precompilation. |
| 85 static bool use_blobs = false; | 86 static bool use_blobs = false; |
| 86 | 87 |
| 87 | 88 |
| 88 // Global flag that is used to indicate that we want to compile everything in | 89 // Global flag that is used to indicate that we want to compile everything in |
| 89 // the same way as precompilation before main, then continue running in the | 90 // the same way as precompilation before main, then continue running in the |
| 90 // same process. | 91 // same process. |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 CommandLineOptions* vm_options) { | 318 CommandLineOptions* vm_options) { |
| 318 ASSERT(arg != NULL); | 319 ASSERT(arg != NULL); |
| 319 if (*arg != '\0') { | 320 if (*arg != '\0') { |
| 320 return false; | 321 return false; |
| 321 } | 322 } |
| 322 compile_all = true; | 323 compile_all = true; |
| 323 return true; | 324 return true; |
| 324 } | 325 } |
| 325 | 326 |
| 326 | 327 |
| 328 static bool ProcessParseAllOption(const char* arg, |
| 329 CommandLineOptions* vm_options) { |
| 330 ASSERT(arg != NULL); |
| 331 if (*arg != '\0') { |
| 332 return false; |
| 333 } |
| 334 parse_all = true; |
| 335 return true; |
| 336 } |
| 337 |
| 338 |
| 327 static bool ProcessUseBlobsOption(const char* arg, | 339 static bool ProcessUseBlobsOption(const char* arg, |
| 328 CommandLineOptions* vm_options) { | 340 CommandLineOptions* vm_options) { |
| 329 ASSERT(arg != NULL); | 341 ASSERT(arg != NULL); |
| 330 if (*arg != '\0') { | 342 if (*arg != '\0') { |
| 331 return false; | 343 return false; |
| 332 } | 344 } |
| 333 use_blobs = true; | 345 use_blobs = true; |
| 334 return true; | 346 return true; |
| 335 } | 347 } |
| 336 | 348 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 { "-h", ProcessHelpOption }, | 552 { "-h", ProcessHelpOption }, |
| 541 { "--help", ProcessHelpOption }, | 553 { "--help", ProcessHelpOption }, |
| 542 { "--packages=", ProcessPackagesOption }, | 554 { "--packages=", ProcessPackagesOption }, |
| 543 { "--package-root=", ProcessPackageRootOption }, | 555 { "--package-root=", ProcessPackageRootOption }, |
| 544 { "-v", ProcessVerboseOption }, | 556 { "-v", ProcessVerboseOption }, |
| 545 { "--verbose", ProcessVerboseOption }, | 557 { "--verbose", ProcessVerboseOption }, |
| 546 { "--version", ProcessVersionOption }, | 558 { "--version", ProcessVersionOption }, |
| 547 | 559 |
| 548 // VM specific options to the standalone dart program. | 560 // VM specific options to the standalone dart program. |
| 549 { "--compile_all", ProcessCompileAllOption }, | 561 { "--compile_all", ProcessCompileAllOption }, |
| 562 { "--parse_all", ProcessParseAllOption }, |
| 550 { "--enable-vm-service", ProcessEnableVmServiceOption }, | 563 { "--enable-vm-service", ProcessEnableVmServiceOption }, |
| 551 { "--disable-service-origin-check", ProcessDisableServiceOriginCheckOption }, | 564 { "--disable-service-origin-check", ProcessDisableServiceOriginCheckOption }, |
| 552 { "--observe", ProcessObserveOption }, | 565 { "--observe", ProcessObserveOption }, |
| 553 { "--snapshot=", ProcessSnapshotFilenameOption }, | 566 { "--snapshot=", ProcessSnapshotFilenameOption }, |
| 554 { "--snapshot-kind=", ProcessSnapshotKindOption }, | 567 { "--snapshot-kind=", ProcessSnapshotKindOption }, |
| 555 { "--run-app-snapshot=", ProcessRunAppSnapshotOption }, | 568 { "--run-app-snapshot=", ProcessRunAppSnapshotOption }, |
| 556 { "--use-blobs", ProcessUseBlobsOption }, | 569 { "--use-blobs", ProcessUseBlobsOption }, |
| 557 { "--trace-loading", ProcessTraceLoadingOption }, | 570 { "--trace-loading", ProcessTraceLoadingOption }, |
| 558 { "--hot-reload-test-mode", ProcessHotReloadTestModeOption }, | 571 { "--hot-reload-test-mode", ProcessHotReloadTestModeOption }, |
| 559 { "--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption }, | 572 { "--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption }, |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 fflush(stderr); | 1521 fflush(stderr); |
| 1509 exit(kErrorExitCode); | 1522 exit(kErrorExitCode); |
| 1510 } | 1523 } |
| 1511 } | 1524 } |
| 1512 | 1525 |
| 1513 if (compile_all) { | 1526 if (compile_all) { |
| 1514 result = Dart_CompileAll(); | 1527 result = Dart_CompileAll(); |
| 1515 CHECK_RESULT(result); | 1528 CHECK_RESULT(result); |
| 1516 } | 1529 } |
| 1517 | 1530 |
| 1531 if (parse_all) { |
| 1532 result = Dart_ParseAll(); |
| 1533 CHECK_RESULT(result); |
| 1534 Dart_ExitScope(); |
| 1535 // Shutdown the isolate. |
| 1536 Dart_ShutdownIsolate(); |
| 1537 return false; |
| 1538 } |
| 1539 |
| 1518 if (is_noopt || (gen_snapshot_kind == kAppAOT)) { | 1540 if (is_noopt || (gen_snapshot_kind == kAppAOT)) { |
| 1519 Dart_QualifiedFunctionName standalone_entry_points[] = { | 1541 Dart_QualifiedFunctionName standalone_entry_points[] = { |
| 1520 { "dart:_builtin", "::", "_getMainClosure" }, | 1542 { "dart:_builtin", "::", "_getMainClosure" }, |
| 1521 { "dart:_builtin", "::", "_getPrintClosure" }, | 1543 { "dart:_builtin", "::", "_getPrintClosure" }, |
| 1522 { "dart:_builtin", "::", "_getUriBaseClosure" }, | 1544 { "dart:_builtin", "::", "_getUriBaseClosure" }, |
| 1523 { "dart:_builtin", "::", "_resolveInWorkingDirectory" }, | 1545 { "dart:_builtin", "::", "_resolveInWorkingDirectory" }, |
| 1524 { "dart:_builtin", "::", "_setWorkingDirectory" }, | 1546 { "dart:_builtin", "::", "_setWorkingDirectory" }, |
| 1525 { "dart:_builtin", "::", "_setPackageRoot" }, | 1547 { "dart:_builtin", "::", "_setPackageRoot" }, |
| 1526 { "dart:_builtin", "::", "_setPackagesMap" }, | 1548 { "dart:_builtin", "::", "_setPackagesMap" }, |
| 1527 { "dart:_builtin", "::", "_libraryFilePath" }, | 1549 { "dart:_builtin", "::", "_libraryFilePath" }, |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 Platform::Exit(Process::GlobalExitCode()); | 1890 Platform::Exit(Process::GlobalExitCode()); |
| 1869 } | 1891 } |
| 1870 | 1892 |
| 1871 } // namespace bin | 1893 } // namespace bin |
| 1872 } // namespace dart | 1894 } // namespace dart |
| 1873 | 1895 |
| 1874 int main(int argc, char** argv) { | 1896 int main(int argc, char** argv) { |
| 1875 dart::bin::main(argc, argv); | 1897 dart::bin::main(argc, argv); |
| 1876 UNREACHABLE(); | 1898 UNREACHABLE(); |
| 1877 } | 1899 } |
| OLD | NEW |