Various runtime/JNI related fixes.

NewObject returns NULL if exception is thrown in constructor.
Allocate the peer then call constructor to ensure peer_ field is
initialized.
Change thread state for AddFinalizer and pass current thread through for
ease.

Change-Id: Ib578b6d44b08aef10fde5d8bc27cc6a2acbf6fae
diff --git a/src/heap.h b/src/heap.h
index 923b015..8897405 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -32,6 +32,7 @@
 class Mutex;
 class Object;
 class Space;
+class Thread;
 class HeapBitmap;
 
 class Heap {
@@ -194,7 +195,7 @@
   // dlmalloc_walk_heap-compatible heap walker.
   static void WalkHeap(void(*callback)(const void*, size_t, const void*, size_t, void*), void* arg);
 
-  static void AddFinalizerReference(Object* object);
+  static void AddFinalizerReference(Thread* self, Object* object);
 
   static size_t GetBytesAllocated() { return num_bytes_allocated_; }
   static size_t GetObjectsAllocated() { return num_objects_allocated_; }