Clean up shadow frame.

Created version of GetThisObject that takes num_ins to get the object
without having to get the code item again. Also using memset to clear
the registers on initialization.

Change-Id: I02b255f0c47d2d3c55783f4c96dc93983015f019
diff --git a/src/stack.cc b/src/stack.cc
index 8690a36..c32b822 100644
--- a/src/stack.cc
+++ b/src/stack.cc
@@ -42,6 +42,15 @@
   }
 }
 
+mirror::Object* ShadowFrame::GetThisObject(uint16_t num_ins) const {
+  mirror::AbstractMethod* m = GetMethod();
+  if (m->IsStatic()) {
+    return NULL;
+  } else {
+    return GetVRegReference(number_of_vregs_ - num_ins);
+  }
+}
+
 ThrowLocation ShadowFrame::GetCurrentLocationForThrow() const {
   return ThrowLocation(GetThisObject(), GetMethod(), GetDexPC());
 }