Various performance improvements.

Performance had regressed due to verify object and method invocation changes.
Avoid trampolines for static calls in same class.
Various inlining changes.
Make verify object something that's only compiled-in in debug builds.

Change-Id: Ia261a52232c3b10667c668f8adfadc0da3048bc5
diff --git a/src/indirect_reference_table.cc b/src/indirect_reference_table.cc
index 720380a..0287d74 100644
--- a/src/indirect_reference_table.cc
+++ b/src/indirect_reference_table.cc
@@ -65,7 +65,7 @@
 bool IndirectReferenceTable::CheckEntry(const char* what, IndirectRef iref, int idx) const {
   const mirror::Object* obj = table_[idx];
   IndirectRef checkRef = ToIndirectRef(obj, idx);
-  if (checkRef != iref) {
+  if (UNLIKELY(checkRef != iref)) {
     LOG(ERROR) << "JNI ERROR (app bug): attempt to " << what
                << " stale " << kind_ << " " << iref
                << " (should be " << checkRef << ")";
@@ -162,11 +162,11 @@
 // Verifies that the indirect table lookup is valid.
 // Returns "false" if something looks bad.
 bool IndirectReferenceTable::GetChecked(IndirectRef iref) const {
-  if (iref == NULL) {
+  if (UNLIKELY(iref == NULL)) {
     LOG(WARNING) << "Attempt to look up NULL " << kind_;
     return false;
   }
-  if (GetIndirectRefKind(iref) == kSirtOrInvalid) {
+  if (UNLIKELY(GetIndirectRefKind(iref) == kSirtOrInvalid)) {
     LOG(ERROR) << "JNI ERROR (app bug): invalid " << kind_ << " " << iref;
     AbortMaybe();
     return false;
@@ -174,20 +174,20 @@
 
   int topIndex = segment_state_.parts.topIndex;
   int idx = ExtractIndex(iref);
-  if (idx >= topIndex) {
+  if (UNLIKELY(idx >= topIndex)) {
     LOG(ERROR) << "JNI ERROR (app bug): accessed stale " << kind_ << " "
                << iref << " (index " << idx << " in a table of size " << topIndex << ")";
     AbortMaybe();
     return false;
   }
 
-  if (table_[idx] == NULL) {
+  if (UNLIKELY(table_[idx] == NULL)) {
     LOG(ERROR) << "JNI ERROR (app bug): accessed deleted " << kind_ << " " << iref;
     AbortMaybe();
     return false;
   }
 
-  if (!CheckEntry("use", iref, idx)) {
+  if (UNLIKELY(!CheckEntry("use", iref, idx))) {
     return false;
   }