Late method resolution.

Change-Id: Ic35348022391c3c11a1d4984b9add7b6ef53aa4c
diff --git a/src/object.cc b/src/object.cc
index 2cf8a6c..f2bddc3 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -40,6 +40,7 @@
 
 #if defined(ART_USE_LLVM_COMPILER)
 #include "compiler_llvm/inferred_reg_category_map.h"
+#include "compiler_llvm/runtime_support_llvm.h"
 using art::compiler_llvm::InferredRegCategoryMap;
 #endif
 
@@ -559,6 +560,7 @@
 void Method::Invoke(Thread* self, Object* receiver, JValue* args, JValue* result) const {
   // Push a transition back into managed code onto the linked list in thread.
   CHECK_EQ(Thread::kRunnable, self->GetState());
+
 #if !defined(ART_USE_LLVM_COMPILER)
   NativeToManagedRecord record;
   self->PushNativeToManagedRecord(&record);
@@ -570,6 +572,14 @@
 
   bool have_executable_code = (GetCode() != NULL);
 
+#if defined(ART_USE_LLVM_COMPILER)
+  if (stub == NULL && !have_executable_code) {
+    art_ensure_link_from_code(const_cast<Method*>(this));
+    stub = GetInvokeStub();
+    have_executable_code = (GetCode() != NULL);
+  }
+#endif
+
   if (Runtime::Current()->IsStarted() && have_executable_code && stub != NULL) {
     bool log = false;
     if (log) {