Add AbstractMethod, Constructor, Method

Moves functionality to ART from libcore. Precursor to moving
ArtMethods to native. Mostly performance improvements.

N5 perf before (irrelevant results removed):
            Class_getConstructor  962.87 ===========
         Class_getDeclaredMethod 2394.37 ============================
                 Class_getMethod 2509.20 ==============================
               Class_newInstance 1999.81 =======================
                  Method_invokeI 1439.02 =================
          Method_invokePreBoxedI 1415.82 ================
            Method_invokeStaticI 1456.24 =================
    Method_invokeStaticPreBoxedI 1427.32 =================
            Method_invokeStaticV  814.47 =========
                  Method_invokeV  816.56 =========
After:
                       benchmark      ns linear runtime
            Class_getConstructor 1302.04 ================
         Class_getDeclaredMethod 1459.01 ==================
                 Class_getMethod 1560.40 ===================
               Class_newInstance 2029.94 =========================
                  Method_invokeI 1312.89 ================
          Method_invokePreBoxedI 1255.01 ===============
            Method_invokeStaticI 1289.13 ===============
    Method_invokeStaticPreBoxedI 1196.52 ==============
            Method_invokeStaticV  790.82 =========
                  Method_invokeV  791.73 =========

Performance improvements are more than just fixing regressions introduced
in: http://android-review.googlesource.com/#/c/146069/

Bug: 19264997

Change-Id: Ife79c469fdb09f30e3aefcfc3e0ce5ed32303fce
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
index 5e1a4c5..c33f81a 100644
--- a/runtime/native/java_lang_reflect_Constructor.cc
+++ b/runtime/native/java_lang_reflect_Constructor.cc
@@ -21,6 +21,7 @@
 #include "mirror/art_method.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/class-inl.h"
+#include "mirror/method.h"
 #include "mirror/object-inl.h"
 #include "reflection.h"
 #include "scoped_fast_native_object_access.h"
@@ -28,17 +29,10 @@
 
 namespace art {
 
-/*
- * We get here through Constructor.newInstance().  The Constructor object
- * would not be available if the constructor weren't public (per the
- * definition of Class.getConstructor), so we can skip the method access
- * check.  We can also safely assume the constructor isn't associated
- * with an interface, array, or primitive class.
- */
-static jobject Constructor_newInstance(JNIEnv* env, jobject javaMethod, jobjectArray javaArgs,
-                                       jboolean accessible) {
+static ALWAYS_INLINE inline jobject NewInstanceHelper(
+    JNIEnv* env, jobject javaMethod, jobjectArray javaArgs, size_t num_frames) {
   ScopedFastNativeObjectAccess soa(env);
-  mirror::ArtMethod* m = mirror::ArtMethod::FromReflectedMethod(soa, javaMethod);
+  mirror::Method* m = soa.Decode<mirror::Method*>(javaMethod);
   StackHandleScope<1> hs(soa.Self());
   Handle<mirror::Class> c(hs.NewHandle(m->GetDeclaringClass()));
   if (UNLIKELY(c->IsAbstract())) {
@@ -67,14 +61,31 @@
   }
 
   jobject javaReceiver = soa.AddLocalReference<jobject>(receiver);
-  InvokeMethod(soa, javaMethod, javaReceiver, javaArgs, (accessible == JNI_TRUE));
+  InvokeMethod(soa, javaMethod, javaReceiver, javaArgs, num_frames);
 
   // Constructors are ()V methods, so we shouldn't touch the result of InvokeMethod.
   return javaReceiver;
 }
 
+/*
+ * We get here through Constructor.newInstance().  The Constructor object
+ * would not be available if the constructor weren't public (per the
+ * definition of Class.getConstructor), so we can skip the method access
+ * check.  We can also safely assume the constructor isn't associated
+ * with an interface, array, or primitive class.
+ */
+static jobject Constructor_newInstance(JNIEnv* env, jobject javaMethod, jobjectArray javaArgs) {
+  return NewInstanceHelper(env, javaMethod, javaArgs, 1);
+}
+
+static jobject Constructor_newInstanceTwoFrames(JNIEnv* env, jobject javaMethod,
+                                                jobjectArray javaArgs) {
+  return NewInstanceHelper(env, javaMethod, javaArgs, 2);
+}
+
 static JNINativeMethod gMethods[] = {
-  NATIVE_METHOD(Constructor, newInstance, "!([Ljava/lang/Object;Z)Ljava/lang/Object;"),
+  NATIVE_METHOD(Constructor, newInstance, "!([Ljava/lang/Object;)Ljava/lang/Object;"),
+  NATIVE_METHOD(Constructor, newInstanceTwoFrames, "!([Ljava/lang/Object;)Ljava/lang/Object;"),
 };
 
 void register_java_lang_reflect_Constructor(JNIEnv* env) {