Support proxy method in StackVisitor::GetThisObject

Adds function artQuickGetProxyThisObject which returns the 'this'
object of the proxy method using the QuickArgumentVisitor. Since
proxy methods have the same layout than the kRefsAndArgs runtime
method and 'this' is the 1st method argument, it is located in the
first GPR.

Bug: 17965861
Change-Id: Ic6ef6c83b9a549c25f9929d5e00ffe1d3a9a36f0
diff --git a/runtime/stack.cc b/runtime/stack.cc
index 43714b9..aaa5b89 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -113,6 +113,9 @@
   }
 }
 
+extern "C" mirror::Object* artQuickGetProxyThisObject(StackReference<mirror::ArtMethod>* sp)
+    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
 mirror::Object* StackVisitor::GetThisObject() const {
   mirror::ArtMethod* m = GetMethod();
   if (m->IsStatic()) {
@@ -125,6 +128,12 @@
     } else {
       return cur_shadow_frame_->GetVRegReference(0);
     }
+  } else if (m->IsProxyMethod()) {
+    if (cur_quick_frame_ != nullptr) {
+      return artQuickGetProxyThisObject(cur_quick_frame_);
+    } else {
+      return cur_shadow_frame_->GetVRegReference(0);
+    }
   } else if (m->IsOptimized(sizeof(void*))) {
     // TODO: Implement, currently only used for exceptions when jdwp is enabled.
     UNIMPLEMENTED(WARNING)