ART: Rewrite core image detection.

Remove unused compiler option `core_image_` and cache
the IsCompilingWithCoreImage in the CompilerOptions instead.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: Idcf3b6c96dab9a39f823a16778e7698589442cd8
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index d901c01..27773ce 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -732,11 +732,6 @@
     compiler_options_->boot_image_ = !image_filenames_.empty();
     compiler_options_->app_image_ = app_image_fd_ != -1 || !app_image_file_name_.empty();
 
-    if (IsBootImage() && image_filenames_.size() == 1) {
-      const std::string& boot_image_filename = image_filenames_[0];
-      compiler_options_->core_image_ = CompilerDriver::IsCoreImageFilename(boot_image_filename);
-    }
-
     if (IsAppImage() && IsBootImage()) {
       Usage("Can't have both --image and (--app-image-fd or --app-image-file)");
     }
@@ -951,6 +946,9 @@
       }
     }
     compiler_options_->passes_to_run_ = passes_to_run_.get();
+    compiler_options_->compiling_with_core_image_ =
+        !boot_image_filename_.empty() &&
+        CompilerDriver::IsCoreImageFilename(boot_image_filename_);
   }
 
   static bool SupportsDeterministicCompilation() {