Fixes for "null instanceof" and class initialization

First issue was that the codegen seemed to expect r0 to contain 0 for
a false result in the null object case. This is a quick fix to make
that true. Given that the code is doing the work of a null check and
pulling out the object's class, the code should probably just pass the
class to the helper function, making this a case of IsAssignableFrom,
not instanceof.

Second issues were related to missing EnsureInitialized calls in two
different code paths, one coming from reflection, one coming from
managed code. New Class::AllocObject assert should help keep us out of
trouble in the future in this area, although perhaps Heap::AllocObject
should have a check as well.

Change-Id: Ib7975b6457481c1ac85135d38f42c6061e6443a0
diff --git a/src/jni_internal.cc b/src/jni_internal.cc
index fd6d314..0436500 100644
--- a/src/jni_internal.cc
+++ b/src/jni_internal.cc
@@ -691,12 +691,12 @@
     ScopedJniThreadState ts(env);
     CHECK_NE(static_cast<jclass>(NULL), clazz); // TODO: ReportJniError
     if (jobj == NULL) {
-      // NB. JNI is different from regular Java instanceof in this respect
+      // Note: JNI is different from regular Java instanceof in this respect
       return JNI_TRUE;
     } else {
       Object* obj = Decode<Object*>(ts, jobj);
       Class* klass = Decode<Class*>(ts, clazz);
-      return Object::InstanceOf(obj, klass) ? JNI_TRUE : JNI_FALSE;
+      return obj->InstanceOf(klass) ? JNI_TRUE : JNI_FALSE;
     }
   }