Add fast path to VMClassLoader.findLoadedClass

VMClassLoader.findLoadedClass now calls FindClassInPathClassLoader
as a fast path. Exclusive time results (trace view maps launch):

Before:
nativeFillInStackTrace 1.4%
defineClassNative 1.2%
findLoadedClass 0.2%

After:
nativeFillInStackTrace 0.5%
defineClassNative 0.0%
findLoadedClass 0.9%

(cherry picked from commit 194116c836080de14245a3a7c4617d07b8abf8cf)

Change-Id: I63fd7b4bccb71789e92bd39d1d3f9d0de22535de
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index fefddae..761e800 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -31,16 +31,23 @@
   if (name.c_str() == NULL) {
     return NULL;
   }
-
+  ClassLinker* cl = Runtime::Current()->GetClassLinker();
   std::string descriptor(DotToDescriptor(name.c_str()));
-  mirror::Class* c = Runtime::Current()->GetClassLinker()->LookupClass(descriptor.c_str(), loader);
+  mirror::Class* c = cl->LookupClass(descriptor.c_str(), loader);
   if (c != NULL && c->IsResolved()) {
     return soa.AddLocalReference<jclass>(c);
-  } else {
-    // Class wasn't resolved so it may be erroneous or not yet ready, force the caller to go into
-    // the regular loadClass code.
-    return NULL;
   }
+  if (loader != nullptr) {
+    // Try the common case.
+    StackHandleScope<1> hs(soa.Self());
+    c = cl->FindClassInPathClassLoader(soa, soa.Self(), descriptor.c_str(), hs.NewHandle(loader));
+    if (c != nullptr) {
+      return soa.AddLocalReference<jclass>(c);
+    }
+  }
+  // Class wasn't resolved so it may be erroneous or not yet ready, force the caller to go into
+  // the regular loadClass code.
+  return NULL;
 }
 
 static jint VMClassLoader_getBootClassPathSize(JNIEnv*, jclass) {