Change Thread::peer_ to be a jobject instead of an Object*

Fixes issue where GC was freeing the java peer if the parent thread exited before the child thread got registered.

Change-Id: I6fbe74865d5827d243ac55fc396679afa97ff2f9
diff --git a/src/native/java_lang_Thread.cc b/src/native/java_lang_Thread.cc
index adc246a..2a6f177 100644
--- a/src/native/java_lang_Thread.cc
+++ b/src/native/java_lang_Thread.cc
@@ -25,8 +25,7 @@
 namespace art {
 
 static jobject Thread_currentThread(JNIEnv* env, jclass) {
-  ScopedObjectAccess soa(env);
-  return soa.AddLocalReference<jobject>(soa.Self()->GetPeer());
+  return reinterpret_cast<JNIEnvExt*>(env)->self->GetPeer();
 }
 
 static jboolean Thread_interrupted(JNIEnv* env, jclass) {
@@ -110,9 +109,8 @@
   ScopedUtfChars name(env, java_name);
   {
     ScopedObjectAccess soa(env);
-    Thread* self = Thread::Current();
-    if (soa.Decode<Object*>(peer) == self->GetPeer()) {
-      self->SetThreadName(name.c_str());
+    if (soa.Env()->IsSameObject(peer, soa.Self()->GetPeer())) {
+      soa.Self()->SetThreadName(name.c_str());
       return;
     }
   }