Add a runtime flag to use JIT Zygote image.

Currently, the platform is passing non-existing boot image locations
with profile specifications via `-Ximage` to tell the runtime to use
JIT Zygote image. This is not flexible. This new `-Xusejitzygoteimage`
flag allows the platform to achieve the same thing without explicitly
specifying the locations.

This is so far a no-op change as the behavior of the new flag mirrors
the current behavior of the platform.

Bug: 203492478
Test: manual -
  1. Build a system image and flash it to a device.
  2. adb shell setprop dalvik.vm.extra-opts '-verbose:image'
  3. adb shell setprop dalvik.vm.profilebootclasspath true
  4. adb shell setprop ctl.restart zygote
  5. See the boot image extension being compiled in memory
     (http://gpaste/4688561208033280).
Change-Id: I3267b5e84136a13913722fae5a34dbea9c2bf960
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 7b108b5..f8bad3f 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -181,6 +181,8 @@
       .Define("-Ximage:_")
           .WithType<ParseStringList<':'>>()
           .IntoKey(M::Image)
+      .Define("-Xforcejitzygote")
+          .IntoKey(M::ForceJitZygote)
       .Define("-Xprimaryzygote")
           .IntoKey(M::PrimaryZygote)
       .Define("-Xbootclasspath-locations:_")
@@ -724,6 +726,16 @@
     }
   }
 
+  if (args.Exists(M::ForceJitZygote)) {
+    if (args.Exists(M::Image)) {
+      Usage("-Ximage and -Xforcejitzygote cannot be specified together\n");
+      Exit(0);
+    }
+    args.Set(
+        M::Image,
+        ParseStringList<':'>{{"boot.art", "/nonx/boot-framework.art!/system/etc/boot-image.prof"}});
+  }
+
   if (!args.Exists(M::CompilerCallbacksPtr) && !args.Exists(M::Image)) {
     const bool deny_art_apex_data_files = args.Exists(M::DenyArtApexDataFiles);
     std::string image_locations =
diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def
index 5df8421..76d1657 100644
--- a/runtime/runtime_options.def
+++ b/runtime/runtime_options.def
@@ -46,6 +46,7 @@
 RUNTIME_OPTIONS_KEY (ParseIntList<':'>,   BootClassPathOatFds)     // std::vector<int>
 RUNTIME_OPTIONS_KEY (std::string,         ClassPath)
 RUNTIME_OPTIONS_KEY (ParseStringList<':'>,Image)
+RUNTIME_OPTIONS_KEY (Unit,                ForceJitZygote)
 RUNTIME_OPTIONS_KEY (Unit,                CheckJni)
 RUNTIME_OPTIONS_KEY (Unit,                JniOptsForceCopy)
 RUNTIME_OPTIONS_KEY (std::string,         JdwpOptions,                    "suspend=n,server=y")