Use dex cache for GetResolvedMethod

Using the dex cache is faster than going through the class linker.
This reverts to behavior from before aog/321573.

Speeds up pmd benchmark by ~50%.

Test: test-art-host

Change-Id: I58403aec03e2b7e7a3d3e108319cfb4c75a680cb
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index ac0ce36..28aca6c 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -76,6 +76,10 @@
   // Lookup the declaring class of the inlined method.
   const DexFile* dex_file = caller->GetDexFile();
   const DexFile::MethodId& method_id = dex_file->GetMethodId(method_index);
+  ArtMethod* inlined_method = caller->GetDexCacheResolvedMethod(method_index, kRuntimePointerSize);
+  if (inlined_method != nullptr && !inlined_method->IsRuntimeMethod()) {
+    return inlined_method;
+  }
   const char* descriptor = dex_file->StringByTypeIdx(method_id.class_idx_);
   ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
   Thread* self = Thread::Current();
@@ -92,8 +96,7 @@
   const char* method_name = dex_file->GetMethodName(method_id);
   const Signature signature = dex_file->GetMethodSignature(method_id);
 
-  ArtMethod* inlined_method =
-      klass->FindDeclaredDirectMethod(method_name, signature, kRuntimePointerSize);
+  inlined_method = klass->FindDeclaredDirectMethod(method_name, signature, kRuntimePointerSize);
   if (inlined_method == nullptr) {
     inlined_method = klass->FindDeclaredVirtualMethod(method_name, signature, kRuntimePointerSize);
     if (inlined_method == nullptr) {
@@ -103,6 +106,7 @@
                  << "This must be due to duplicate classes or playing wrongly with class loaders";
     }
   }
+  caller->SetDexCacheResolvedMethod(method_index, inlined_method, kRuntimePointerSize);
 
   return inlined_method;
 }