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

Unified Diff: runtime/bin/main.cc

Issue 2483373002: Add Kernel Isolate (Closed)
Patch Set: wip 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 0adf4ac957f8fd899344dea432b59a09f37366df..72cb321c91a231b99c3a3256c2368891dbffc180 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -61,6 +61,10 @@ enum SnapshotKind {
};
static SnapshotKind gen_snapshot_kind = kNone;
+static bool use_dart_frontend = false;
+
+static const char* frontend_filename = NULL;
+
// Value of the --package-root flag.
// (This pointer points into an argv buffer and does not need to be
// free'd.)
@@ -324,6 +328,18 @@ static bool ProcessParseAllOption(const char* arg,
}
+static bool ProcessFrontendOption(const char* filename,
+ CommandLineOptions* vm_options) {
+ ASSERT(filename != NULL);
+ if (filename[0] == '\0') {
+ return false;
+ }
+ use_dart_frontend = true;
+ frontend_filename = filename;
+ return true;
+}
+
+
static bool ProcessUseBlobsOption(const char* arg,
CommandLineOptions* vm_options) {
ASSERT(arg != NULL);
@@ -540,6 +556,7 @@ static struct {
// VM specific options to the standalone dart program.
{"--compile_all", ProcessCompileAllOption},
{"--parse_all", ProcessParseAllOption},
+ {"--dfe=", ProcessFrontendOption},
{"--enable-vm-service", ProcessEnableVmServiceOption},
{"--disable-service-origin-check", ProcessDisableServiceOriginCheckOption},
{"--observe", ProcessObserveOption},
@@ -791,6 +808,16 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
(strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0)) {
return NULL;
}
+ if (strcmp(script_uri, DART_KERNEL_ISOLATE_NAME) == 0) {
+ if (!use_dart_frontend) {
+ *error = strdup("Kernel isolate not supported.");
+ return NULL;
+ } else {
+ if (packages_config == NULL) {
+ packages_config = commandline_packages_file;
+ }
+ }
+ }
// If the script is a Kernel binary, then we will try to bootstrap from the
// script.
@@ -870,6 +897,10 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
CHECK_RESULT(result);
}
+ if (Dart_IsKernelIsolate(isolate)) {
+ script_uri = frontend_filename;
+ }
+
// Setup package root if specified.
result = DartUtils::SetupPackageRoot(package_root, packages_config);
CHECK_RESULT(result);
@@ -877,6 +908,13 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
result = Dart_SetEnvironmentCallback(EnvironmentCallback);
CHECK_RESULT(result);
+ if (!Dart_IsKernelIsolate(isolate) && use_dart_frontend) {
+ Log::Print("Waiting for Kernel isolate to load.\n");
Cutch 2016/12/01 19:47:23 we shouldn't print to stdout here because it will
hausner 2016/12/03 01:29:00 Done.
+ // This must be the main script to be loaded. Wait for Kernel isolate
+ // to finish initialization.
+ Dart_ServiceWaitForKernelPort();
siva 2016/12/02 00:39:23 If this returns with ILLEGAL_PORT we should return
hausner 2016/12/03 01:29:00 If this return ILLEGAL_PORT, e.g. because there wa
+ }
+
if (run_app_snapshot) {
result = DartUtils::SetupIOLibrary(script_uri);
CHECK_RESULT(result);
« no previous file with comments | « runtime/bin/loader.cc ('k') | runtime/include/dart_api.h » ('j') | runtime/include/dart_api.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698