Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: runtime/bin/main.cc

Issue 2554953004: Revert "Add Kernel Isolate" (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/loader.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 static bool run_app_snapshot = false; 54 static bool run_app_snapshot = false;
55 static const char* snapshot_filename = NULL; 55 static const char* snapshot_filename = NULL;
56 enum SnapshotKind { 56 enum SnapshotKind {
57 kNone, 57 kNone,
58 kScript, 58 kScript,
59 kAppAOT, 59 kAppAOT,
60 kAppJIT, 60 kAppJIT,
61 }; 61 };
62 static SnapshotKind gen_snapshot_kind = kNone; 62 static SnapshotKind gen_snapshot_kind = kNone;
63 63
64 static bool use_dart_frontend = false;
65
66 static const char* frontend_filename = NULL;
67
68 // Value of the --package-root flag. 64 // Value of the --package-root flag.
69 // (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
70 // free'd.) 66 // free'd.)
71 static const char* commandline_package_root = NULL; 67 static const char* commandline_package_root = NULL;
72 68
73 // Value of the --packages flag. 69 // Value of the --packages flag.
74 // (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
75 // free'd.) 71 // free'd.)
76 static const char* commandline_packages_file = NULL; 72 static const char* commandline_packages_file = NULL;
77 73
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 CommandLineOptions* vm_options) { 317 CommandLineOptions* vm_options) {
322 ASSERT(arg != NULL); 318 ASSERT(arg != NULL);
323 if (*arg != '\0') { 319 if (*arg != '\0') {
324 return false; 320 return false;
325 } 321 }
326 parse_all = true; 322 parse_all = true;
327 return true; 323 return true;
328 } 324 }
329 325
330 326
331 static bool ProcessFrontendOption(const char* filename,
332 CommandLineOptions* vm_options) {
333 ASSERT(filename != NULL);
334 if (filename[0] == '\0') {
335 return false;
336 }
337 use_dart_frontend = true;
338 frontend_filename = filename;
339 return true;
340 }
341
342
343 static bool ProcessUseBlobsOption(const char* arg, 327 static bool ProcessUseBlobsOption(const char* arg,
344 CommandLineOptions* vm_options) { 328 CommandLineOptions* vm_options) {
345 ASSERT(arg != NULL); 329 ASSERT(arg != NULL);
346 if (*arg != '\0') { 330 if (*arg != '\0') {
347 return false; 331 return false;
348 } 332 }
349 use_blobs = true; 333 use_blobs = true;
350 return true; 334 return true;
351 } 335 }
352 336
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 {"--help", ProcessHelpOption}, 533 {"--help", ProcessHelpOption},
550 {"--packages=", ProcessPackagesOption}, 534 {"--packages=", ProcessPackagesOption},
551 {"--package-root=", ProcessPackageRootOption}, 535 {"--package-root=", ProcessPackageRootOption},
552 {"-v", ProcessVerboseOption}, 536 {"-v", ProcessVerboseOption},
553 {"--verbose", ProcessVerboseOption}, 537 {"--verbose", ProcessVerboseOption},
554 {"--version", ProcessVersionOption}, 538 {"--version", ProcessVersionOption},
555 539
556 // VM specific options to the standalone dart program. 540 // VM specific options to the standalone dart program.
557 {"--compile_all", ProcessCompileAllOption}, 541 {"--compile_all", ProcessCompileAllOption},
558 {"--parse_all", ProcessParseAllOption}, 542 {"--parse_all", ProcessParseAllOption},
559 {"--dfe=", ProcessFrontendOption},
560 {"--enable-vm-service", ProcessEnableVmServiceOption}, 543 {"--enable-vm-service", ProcessEnableVmServiceOption},
561 {"--disable-service-origin-check", ProcessDisableServiceOriginCheckOption}, 544 {"--disable-service-origin-check", ProcessDisableServiceOriginCheckOption},
562 {"--observe", ProcessObserveOption}, 545 {"--observe", ProcessObserveOption},
563 {"--snapshot=", ProcessSnapshotFilenameOption}, 546 {"--snapshot=", ProcessSnapshotFilenameOption},
564 {"--snapshot-kind=", ProcessSnapshotKindOption}, 547 {"--snapshot-kind=", ProcessSnapshotKindOption},
565 {"--use-blobs", ProcessUseBlobsOption}, 548 {"--use-blobs", ProcessUseBlobsOption},
566 {"--trace-loading", ProcessTraceLoadingOption}, 549 {"--trace-loading", ProcessTraceLoadingOption},
567 {"--hot-reload-test-mode", ProcessHotReloadTestModeOption}, 550 {"--hot-reload-test-mode", ProcessHotReloadTestModeOption},
568 {"--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption}, 551 {"--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption},
569 {"--short_socket_read", ProcessShortSocketReadOption}, 552 {"--short_socket_read", ProcessShortSocketReadOption},
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 const bool run_service_isolate = needs_load_port; 784 const bool run_service_isolate = needs_load_port;
802 #else 785 #else
803 // Always create the service isolate in DEBUG and RELEASE modes for profiling, 786 // Always create the service isolate in DEBUG and RELEASE modes for profiling,
804 // even if we don't need it for loading. 787 // even if we don't need it for loading.
805 const bool run_service_isolate = true; 788 const bool run_service_isolate = true;
806 #endif // PRODUCT 789 #endif // PRODUCT
807 if (!run_service_isolate && 790 if (!run_service_isolate &&
808 (strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0)) { 791 (strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0)) {
809 return NULL; 792 return NULL;
810 } 793 }
811 if (strcmp(script_uri, DART_KERNEL_ISOLATE_NAME) == 0) {
812 if (!use_dart_frontend) {
813 *error = strdup("Kernel isolate not supported.");
814 return NULL;
815 } else {
816 if (packages_config == NULL) {
817 packages_config = commandline_packages_file;
818 }
819 }
820 }
821 794
822 // If the script is a Kernel binary, then we will try to bootstrap from the 795 // If the script is a Kernel binary, then we will try to bootstrap from the
823 // script. 796 // script.
824 const uint8_t* kernel_file = NULL; 797 const uint8_t* kernel_file = NULL;
825 intptr_t kernel_length = -1; 798 intptr_t kernel_length = -1;
826 const bool is_kernel = 799 const bool is_kernel =
827 !run_app_snapshot && 800 !run_app_snapshot &&
828 TryReadKernel(script_uri, &kernel_file, &kernel_length); 801 TryReadKernel(script_uri, &kernel_file, &kernel_length);
829 802
830 void* kernel_program = NULL; 803 void* kernel_program = NULL;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 result = DartUtils::PrepareForScriptLoading(false, trace_loading); 863 result = DartUtils::PrepareForScriptLoading(false, trace_loading);
891 CHECK_RESULT(result); 864 CHECK_RESULT(result);
892 865
893 if (needs_load_port) { 866 if (needs_load_port) {
894 // Set up the load port provided by the service isolate so that we can 867 // Set up the load port provided by the service isolate so that we can
895 // load scripts. 868 // load scripts.
896 result = DartUtils::SetupServiceLoadPort(); 869 result = DartUtils::SetupServiceLoadPort();
897 CHECK_RESULT(result); 870 CHECK_RESULT(result);
898 } 871 }
899 872
900 if (Dart_IsKernelIsolate(isolate)) {
901 script_uri = frontend_filename;
902 }
903
904 // Setup package root if specified. 873 // Setup package root if specified.
905 result = DartUtils::SetupPackageRoot(package_root, packages_config); 874 result = DartUtils::SetupPackageRoot(package_root, packages_config);
906 CHECK_RESULT(result); 875 CHECK_RESULT(result);
907 876
908 result = Dart_SetEnvironmentCallback(EnvironmentCallback); 877 result = Dart_SetEnvironmentCallback(EnvironmentCallback);
909 CHECK_RESULT(result); 878 CHECK_RESULT(result);
910 879
911 if (!Dart_IsKernelIsolate(isolate) && use_dart_frontend) {
912 Log::PrintErr("Waiting for Kernel isolate to load.\n");
913 // This must be the main script to be loaded. Wait for Kernel isolate
914 // to finish initialization.
915 Dart_Port port = Dart_ServiceWaitForKernelPort();
916 if (port == ILLEGAL_PORT) {
917 *error = strdup("Error while initializing Kernel isolate");
918 return NULL;
919 }
920 }
921
922 if (run_app_snapshot) { 880 if (run_app_snapshot) {
923 result = DartUtils::SetupIOLibrary(script_uri); 881 result = DartUtils::SetupIOLibrary(script_uri);
924 CHECK_RESULT(result); 882 CHECK_RESULT(result);
925 Loader::InitForSnapshot(script_uri); 883 Loader::InitForSnapshot(script_uri);
926 } else { 884 } else {
927 // Load the specified application script into the newly created isolate. 885 // Load the specified application script into the newly created isolate.
928 Dart_Handle uri = 886 Dart_Handle uri =
929 DartUtils::ResolveScript(Dart_NewStringFromCString(script_uri)); 887 DartUtils::ResolveScript(Dart_NewStringFromCString(script_uri));
930 CHECK_RESULT(uri); 888 CHECK_RESULT(uri);
931 if (!is_kernel) { 889 if (!is_kernel) {
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 Platform::Exit(Process::GlobalExitCode()); 1943 Platform::Exit(Process::GlobalExitCode());
1986 } 1944 }
1987 1945
1988 } // namespace bin 1946 } // namespace bin
1989 } // namespace dart 1947 } // namespace dart
1990 1948
1991 int main(int argc, char** argv) { 1949 int main(int argc, char** argv) {
1992 dart::bin::main(argc, argv); 1950 dart::bin::main(argc, argv);
1993 UNREACHABLE(); 1951 UNREACHABLE();
1994 } 1952 }
OLDNEW
« no previous file with comments | « runtime/bin/loader.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698