Implement Object.clone.

Also add a conditional to Thread to keep tests running.

Change-Id: I02145973af0fca823acb689e04912c2020d9c650
diff --git a/src/thread.cc b/src/thread.cc
index 68020d1..9525a1c 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -921,9 +921,12 @@
     }
 
     // this.group.removeThread(this);
-    Method* m = group->GetClass()->FindVirtualMethodForVirtualOrInterface(gThreadGroup_removeThread);
-    Object* args = peer_;
-    m->Invoke(this, group, reinterpret_cast<byte*>(&args), NULL);
+    // group can be null if we're in the compiler or a test.
+    if (group != NULL) {
+      Method* m = group->GetClass()->FindVirtualMethodForVirtualOrInterface(gThreadGroup_removeThread);
+      Object* args = peer_;
+      m->Invoke(this, group, reinterpret_cast<byte*>(&args), NULL);
+    }
 
     // this.vmData = 0;
     SetVmData(peer_, NULL);