Don't run pre-verification if the thread cannot load classes.

In this situation (typically debuggable), the verifier will
fail if verification of a class requires some classes
to be loaded.

Test: 689-zygote-jit-deopt
Bug: 152552491
Change-Id: I8dd6da58c20dddf334965e6735cd6a7fade7bb97
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index f94c51e..df26ca4 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -879,6 +879,12 @@
   ZygoteVerificationTask() {}
 
   void Run(Thread* self) override {
+    // We are going to load class and run verification, which may also need to load
+    // classes. If the thread cannot load classes (typically when the runtime is
+    // debuggable), then just return.
+    if (!self->CanLoadClasses()) {
+      return;
+    }
     Runtime* runtime = Runtime::Current();
     ClassLinker* linker = runtime->GetClassLinker();
     const std::vector<const DexFile*>& boot_class_path =