Add option to force all code to be deoptimizable

Currently this can only be passed during runtime startup. We will add
support for doing it from the zygote in the future.

Bug: 28769520
Bug: 32369913

Test: m test-art-host

Change-Id: I5eb16887ea14b140217c123b3effd47c5c8b2768
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 6d45dad..4b39c5c 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2828,6 +2828,13 @@
     return true;
   }
 
+  if (runtime->IsFullyDeoptable()) {
+    // We need to be able to deoptimize at any time so we should always just ignore precompiled
+    // code and go to the interpreter assuming we don't already have jitted code.
+    jit::Jit* jit = Runtime::Current()->GetJit();
+    return (jit == nullptr) || !jit->GetCodeCache()->ContainsPc(quick_code);
+  }
+
   if (runtime->IsNativeDebuggable()) {
     DCHECK(runtime->UseJitCompilation() && runtime->GetJit()->JitAtFirstUse());
     // If we are doing native debugging, ignore application's AOT code,