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
(cherry picked from commit a836bc9760419af4a515f96c66100a39e865f3b9)

Change-Id: I09b5c1cdfc051d9395bba929d4650804eb3b1f7f
diff --git a/runtime/stack.cc b/runtime/stack.cc
index 56bfff7..3558a81 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -112,6 +112,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()) {
@@ -124,6 +127,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 {
     const DexFile::CodeItem* code_item = m->GetCodeItem();
     if (code_item == NULL) {