Add verifier support for dequickening

Also some cleanup.

Bug: 17950037

Change-Id: I1f50fe07f1558e9c4f78953b7afa639d7f310b3c
diff --git a/runtime/mirror/art_method.h b/runtime/mirror/art_method.h
index 64663ed..9b982b7 100644
--- a/runtime/mirror/art_method.h
+++ b/runtime/mirror/art_method.h
@@ -20,6 +20,7 @@
 #include "dex_file.h"
 #include "gc_root.h"
 #include "invoke_type.h"
+#include "method_reference.h"
 #include "modifiers.h"
 #include "object.h"
 #include "object_callbacks.h"
@@ -522,6 +523,10 @@
   uintptr_t ToNativeQuickPc(const uint32_t dex_pc, bool abort_on_failure = true)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
+  MethodReference ToMethodReference() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    return MethodReference(GetDexFile(), GetDexMethodIndex());
+  }
+
   // Find the catch block for the given exception type and dex_pc. When a catch block is found,
   // indicates whether the found catch block is responsible for clearing the exception or whether
   // a move-exception instruction is present.
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 59efebf..65c5c21 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -3408,7 +3408,7 @@
     return nullptr;
   }
   mirror::ArtMethod* res_method = dispatch_class->GetVTableEntry(vtable_index);
-  if (FailOrAbort(this, !Thread::Current()->IsExceptionPending(),
+  if (FailOrAbort(this, !self_->IsExceptionPending(),
                   "Unexpected exception pending for quickened invoke at ",
                   work_insn_idx_)) {
     return nullptr;
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index 0c4bf3c..c3bd4af 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -238,6 +238,10 @@
   bool HasFailures() const;
   const RegType& ResolveCheckedClass(uint32_t class_idx)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+  mirror::ArtMethod* GetQuickInvokedMethod(const Instruction* inst,
+                                           RegisterLine* reg_line,
+                                           bool is_range)
+        SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
  private:
   // Private constructor for dumping.
@@ -586,11 +590,6 @@
                                                       mirror::ArtMethod* res_method)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
-  mirror::ArtMethod* GetQuickInvokedMethod(const Instruction* inst,
-                                           RegisterLine* reg_line,
-                                           bool is_range)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
   mirror::ArtMethod* VerifyInvokeVirtualQuickArgs(const Instruction* inst, bool is_range)
   SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);