Implement LLVM version of stack walking. Fix Jni_Compiler tests.

Thread.cc has many visitors such as CatchBlockStackVisitor and
ReferenceMapVisitor that assume non-LLVM stack layout. LLVM version's
exception handling and gc have no use of those. Per Ian's suggestion,
this LLVM CL relies on ShadowFrame to implement stack walking. And
we use the same Frame class in LLVM version. Result: The Thread.cc
runtime is common across LLVM and non-LLVM compilers, except for
WalkStack utility in Thread.cc.

Key: LLVM's Frame has its (only) field point to the method* in the
ShadowFrame. With this, we finally pass all the jni_compiler tests.

(cherry picked from commit aa4923361d850f8094a546e84ec18672ebbb19fb)

Conflicts:

	src/stack.cc

Change-Id: I77098ee5fa7b16cb7e21c0de667e3d7ca5be256f
diff --git a/src/thread.cc b/src/thread.cc
index 6b340d2..ae460e4 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -1330,6 +1330,8 @@
   return sirt;
 }
 
+#if !defined(ART_USE_LLVM_COMPILER) // LLVM use ShadowFrame
+
 void Thread::WalkStack(StackVisitor* visitor, bool include_upcalls) const {
   Frame frame = GetTopOfStack();
   uintptr_t pc = ManglePc(top_of_managed_stack_pc_);
@@ -1375,6 +1377,60 @@
   }
 }
 
+#else // defined(ART_USE_LLVM_COMPILER) // LLVM uses ShadowFrame
+
+void Thread::WalkStack(StackVisitor* visitor, bool /*include_upcalls*/) const {
+  for (ShadowFrame* cur = top_shadow_frame_; cur; cur = cur->GetLink()) {
+    Frame frame;
+    frame.SetSP(reinterpret_cast<Method**>(reinterpret_cast<byte*>(cur) +
+                                           ShadowFrame::MethodOffset()));
+    bool should_continue = visitor->VisitFrame(frame, 0);
+    if (!should_continue) {
+      return;
+    }
+  }
+}
+
+/*
+ *                                |                        |
+ *                                |                        |
+ *                                |                        |
+ *                                |      .                 |
+ *                                |      .                 |
+ *                                |      .                 |
+ *                                |      .                 |
+ *                                | Method*                |
+ *                                |      .                 |
+ *                                |      .                 | <-- top_shadow_frame_   (ShadowFrame*)
+ *                              / +------------------------+
+ *                              ->|      .                 |
+ *                              . |      .                 |
+ *                              . |      .                 |
+ *                               /+------------------------+
+ *                              / |      .                 |
+ *                             /  |      .                 |
+ *     ---                     |  |      .                 |
+ *      |                      |  |      .                 |
+ *                             |  | Method*                | <-- frame.GetSP() (Method**)
+ *  ShadowFrame                \  |      .                 |
+ *      |                       ->|      .                 | <-- cur           (ShadowFrame*)
+ *     ---                       /+------------------------+
+ *                              / |      .                 |
+ *                             /  |      .                 |
+ *     ---                     |  |      .                 |
+ *      |       cur->GetLink() |  |      .                 |
+ *                             |  | Method*                |
+ *   ShadowFrame               \  |      .                 |
+ *      |                       ->|      .                 |
+ *     ---                        +------------------------+
+ *                                |      .                 |
+ *                                |      .                 |
+ *                                |      .                 |
+ *                                +========================+
+ */
+
+#endif
+
 jobject Thread::CreateInternalStackTrace(JNIEnv* env) const {
   // Compute depth of stack
   CountStackDepthVisitor count_visitor;