Add resolve method.

Change-Id: I19210e4b0429b92bc725d47e1b4016fa89de54e9
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index a077682..a09b68e 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -2295,6 +2295,35 @@
 }
 
 
+Method* MethodCompiler::ResolveMethod(uint32_t method_idx) {
+  Thread* thread = Thread::Current();
+
+  // Save the exception state
+  Throwable* old_exception = NULL;
+  if (thread->IsExceptionPending()) {
+    old_exception = thread->GetException();
+    thread->ClearException();
+  }
+
+  // Resolve the method through the class linker
+  Method* method = class_linker_->ResolveMethod(*dex_file_, method_idx,
+                                                dex_cache_, class_loader_,
+                                                /* is_direct= */ false);
+
+  if (method == NULL) {
+    // Ignore the exception raised during the method resolution
+    thread->ClearException();
+  }
+
+  // Restore the exception state
+  if (old_exception != NULL) {
+    thread->SetException(old_exception);
+  }
+
+  return method;
+}
+
+
 Field* MethodCompiler::ResolveField(uint32_t field_idx) {
   Thread* thread = Thread::Current();
 
diff --git a/src/compiler_llvm/method_compiler.h b/src/compiler_llvm/method_compiler.h
index 36f90e5..64ecdd6 100644
--- a/src/compiler_llvm/method_compiler.h
+++ b/src/compiler_llvm/method_compiler.h
@@ -342,6 +342,8 @@
 
   RegCategory GetInferredRegCategory(uint32_t dex_pc, uint16_t reg);
 
+  Method* ResolveMethod(uint32_t method_idx);
+
   Field* ResolveField(uint32_t field_idx);
 
   Field* FindFieldAndDeclaringTypeIdx(uint32_t field_idx,