Implement Throwable::nativeFillInStackTrace and nativeGetStackTrace.

Refactor stack trace into compact internal form which is then used to
compute larger and more verbose StackTraceElement[] form. Fix some
potential problems with GC.

Change-Id: I4a4308c1ec5b82fd95b649d5ec0504b9607e688f
diff --git a/src/exception_test.cc b/src/exception_test.cc
index 5283697..d77f1c0 100644
--- a/src/exception_test.cc
+++ b/src/exception_test.cc
@@ -162,7 +162,13 @@
   Thread* thread = Thread::Current();
   thread->SetTopOfStack(fake_stack);
 
-  ObjectArray<StackTraceElement>* trace_array = thread->AllocStackTrace();
+  jobject internal = thread->CreateInternalStackTrace();
+  jobjectArray ste_array =
+      Thread::InternalStackTraceToStackTraceElementArray(internal,
+                                                         thread->GetJniEnv());
+  ObjectArray<StackTraceElement>* trace_array =
+      Decode<ObjectArray<StackTraceElement>*>(thread->GetJniEnv(), ste_array);
+
 
   ASSERT_TRUE(trace_array->Get(0) != NULL);
   EXPECT_STREQ("java.lang.MyClass",