Further proxy refactorings.

Factor the crawling of the quick stack arguments into a common visitor.
Factor the proxy invocation dispatch into common runtime support code,
fix numerous bugs relating to GC in the LLVM runtime support with this.
Clean up BoxPrimitive to not use an in argument as an out.

Change-Id: I7b12c8d88d5083614e480b8fb1d2f2ef7c0a51b7
diff --git a/src/object_utils.h b/src/object_utils.h
index dd5ff05..068dd66 100644
--- a/src/object_utils.h
+++ b/src/object_utils.h
@@ -566,8 +566,7 @@
     return method_->GetDeclaringClass()->GetClassLoader();
   }
 
-  bool IsStatic()
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+  bool IsStatic() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     return method_->IsStatic();
   }
 
@@ -581,28 +580,26 @@
     return (IsStatic() ? 0 : 1) + GetShortyLength() - 1;
   }
 
-  // Is the specified parameter a long or double, where parameter 0 is 'this' for instance methods
-  bool IsParamALongOrDouble(size_t param)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+  // Get the primitive type associated with the given parameter.
+  Primitive::Type GetParamPrimitiveType(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     CHECK_LT(param, NumArgs());
     if (IsStatic()) {
       param++;  // 0th argument must skip return value at start of the shorty
     } else if (param == 0) {
-      return false;  // this argument
+      return Primitive::kPrimNot;
     }
-    char ch = GetShorty()[param];
-    return (ch == 'J' || ch == 'D');
+    return Primitive::GetType(GetShorty()[param]);
   }
 
-  // Is the specified parameter a reference, where parameter 0 is 'this' for instance methods
+  // Is the specified parameter a long or double, where parameter 0 is 'this' for instance methods.
+  bool IsParamALongOrDouble(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    Primitive::Type type = GetParamPrimitiveType(param);
+    return type == Primitive::kPrimLong || type == Primitive::kPrimDouble;
+  }
+
+  // Is the specified parameter a reference, where parameter 0 is 'this' for instance methods.
   bool IsParamAReference(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    CHECK_LT(param, NumArgs());
-    if (IsStatic()) {
-      param++;  // 0th argument must skip return value at start of the shorty
-    } else if (param == 0) {
-      return true;  // this argument
-    }
-    return GetShorty()[param] == 'L';  // An array also has a shorty character of 'L' (not '[')
+    return GetParamPrimitiveType(param) == Primitive::kPrimNot;
   }
 
   bool HasSameNameAndSignature(MethodHelper* other)