ART: Add debug exception check to JIT

Check for a pending exception after JIT compilation finishes.

Test: m ART_TEST_JIT=true test-art-host
Change-Id: I27defaa733f360cb1dbabede62d4908777bc5d2b
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 803e9d5..dac2e60 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -274,6 +274,15 @@
               << ArtMethod::PrettyMethod(method_to_compile)
               << " osr=" << std::boolalpha << osr;
   }
+  if (kIsDebugBuild) {
+    if (self->IsExceptionPending()) {
+      mirror::Throwable* exception = self->GetException();
+      LOG(FATAL) << "No pending exception expected after compiling "
+                 << ArtMethod::PrettyMethod(method)
+                 << ": "
+                 << exception->Dump();
+    }
+  }
   return success;
 }