Refactor StackVisitor to take a Thread*.

This allows assertion checking on the thread, principally that we never try to
walk the stack of an unsuspended thread.
Fix bug in the OwnedMonitorVisitor where GetVReg could be called on a
StackVisitor with no context.

Change-Id: I06539b624b253b6fb7385e7be11a4bced1d417b2
diff --git a/test/ReferenceMap/stack_walk_refmap_jni.cc b/test/ReferenceMap/stack_walk_refmap_jni.cc
index 8b1e6cf..60182e2 100644
--- a/test/ReferenceMap/stack_walk_refmap_jni.cc
+++ b/test/ReferenceMap/stack_walk_refmap_jni.cc
@@ -42,10 +42,9 @@
   } while (false)
 
 struct ReferenceMap2Visitor : public StackVisitor {
-  explicit ReferenceMap2Visitor(const ManagedStack* stack,
-                                const std::deque<InstrumentationStackFrame>* instrumentation_stack)
+  explicit ReferenceMap2Visitor(Thread* thread)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
-      : StackVisitor(stack, instrumentation_stack, NULL) {
+      : StackVisitor(thread, NULL) {
   }
 
   bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -274,9 +273,8 @@
 
 extern "C" JNIEXPORT jint JNICALL Java_ReferenceMap_refmap(JNIEnv*, jobject, jint count) {
   // Visitor
-  ScopedObjectAccess ts(Thread::Current());
-  ReferenceMap2Visitor mapper(Thread::Current()->GetManagedStack(),
-                              Thread::Current()->GetInstrumentationStack());
+  ScopedObjectAccess soa(Thread::Current());
+  ReferenceMap2Visitor mapper(soa.Self());
   mapper.WalkStack();
 
   return count + 1;