Revert "Revert "Use compiler filter to determine oat file status.""

This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.

Add an option to change what OatFileManager considers up-to-date.
In our tests we're allowed to write to the dalvik-cache, so it
cannot be kSpeed.

Bug: 27689078
Change-Id: I0c578705a9921114ed1fb00d360cc7448addc93a
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 512e8b8..96f41b3 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -60,6 +60,7 @@
 #include "base/unix_file/fd_file.h"
 #include "class_linker-inl.h"
 #include "compiler_callbacks.h"
+#include "compiler_filter.h"
 #include "debugger.h"
 #include "elf_file.h"
 #include "entrypoints/runtime_asm_entrypoints.h"
@@ -959,6 +960,16 @@
   experimental_flags_ = runtime_options.GetOrDefault(Opt::Experimental);
   is_low_memory_mode_ = runtime_options.Exists(Opt::LowMemoryMode);
 
+  {
+    CompilerFilter::Filter filter;
+    std::string filter_str = runtime_options.GetOrDefault(Opt::OatFileManagerCompilerFilter);
+    if (!CompilerFilter::ParseCompilerFilter(filter_str.c_str(), &filter)) {
+      LOG(ERROR) << "Cannot parse compiler filter " << filter_str;
+      return false;
+    }
+    OatFileManager::SetCompilerFilter(filter);
+  }
+
   XGcOption xgc_option = runtime_options.GetOrDefault(Opt::GcOption);
   heap_ = new gc::Heap(runtime_options.GetOrDefault(Opt::MemoryInitialSize),
                        runtime_options.GetOrDefault(Opt::HeapGrowthLimit),