No access check support.

This CL adds support to disable access check when a method is preverified (at
compilation time) and we know we don't need to do any access check.

The interpreter has now two modes of execution: with or without access check.
This is realized by using a template function.

A new runtime access flag kAccPreverified is added onto each method belonging
to a preverified class. If this flag is set, we enter the interpreter in "no
access check" mode. Otherwise, we enter the interpreter in "with access check"
mode.

Change-Id: Ic34163421d5b0aca3d1bce22ef7c095dcf465a18
diff --git a/src/mirror/class.cc b/src/mirror/class.cc
index 15129ab..2dae90c 100644
--- a/src/mirror/class.cc
+++ b/src/mirror/class.cc
@@ -604,5 +604,22 @@
   return NULL;
 }
 
+static void SetPreverifiedFlagOnMethods(mirror::ObjectArray<mirror::AbstractMethod>* methods)
+    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+  if (methods != NULL) {
+    for (int32_t index = 0, end = methods->GetLength(); index < end; ++index) {
+      mirror::AbstractMethod* method = methods->GetWithoutChecks(index);
+      DCHECK(method != NULL);
+      method->SetPreverified();
+    }
+  }
+}
+
+void Class::SetPreverifiedFlagOnAllMethods() {
+  DCHECK(IsVerified());
+  SetPreverifiedFlagOnMethods(GetDirectMethods());
+  SetPreverifiedFlagOnMethods(GetVirtualMethods());
+}
+
 }  // namespace mirror
 }  // namespace art