Prevent exception bugs in class linker

There were some places that could throw exceptions but still succeed.
This caused the allocation entrypoints to occasionally allocate a
heap object with a pending exception.
Also added some additional AssertNoExceptionPending.

Bug: 17164348

(cherry picked from commit 58c016c3f85d6d5496cea25325778de3a8d9a3ac)

Change-Id: Id9918fa8f1a5d713b847cb95cdade925ff80a826
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index b874a74..38842cb 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -48,6 +48,8 @@
     if (klass == NULL) {
       DCHECK(self->IsExceptionPending());
       return nullptr;  // Failure
+    } else {
+      DCHECK(!self->IsExceptionPending());
     }
   }
   if (kAccessCheck) {
@@ -80,6 +82,8 @@
     if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(h_klass, true, true)) {
       DCHECK(self->IsExceptionPending());
       return nullptr;  // Failure
+    } else {
+      DCHECK(!self->IsExceptionPending());
     }
     return h_klass.Get();
   }