Additional check to catch BooksTablet monkey issue

Change-Id: I9dfe695b008b2ca23998d2cfb29e5ba04354a029
diff --git a/src/compiler.cc b/src/compiler.cc
index 3388f72..b3d6367 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -963,8 +963,10 @@
   }
 
   void Run() {
+    Thread* self = Thread::Current();
     for (size_t i = begin_; i < end_; i += stripe_) {
       callback_(context_, i);
+      CHECK(!self->IsExceptionPending()) << PrettyTypeOf(self->GetException()) << " " << i;
     }
   }
 
@@ -981,6 +983,8 @@
 };
 
 void ForAll(Context* context, size_t begin, size_t end, Callback callback, size_t thread_count) {
+  Thread* self = Thread::Current();
+  CHECK(!self->IsExceptionPending()) << PrettyTypeOf(self->GetException());
   CHECK_GT(thread_count, 0U);
 
   std::vector<WorkerThread*> threads;
@@ -990,7 +994,7 @@
   threads[0]->Go();
 
   // Switch to kVmWait while we're blocked waiting for the other threads to finish.
-  ScopedThreadStateChange tsc(Thread::Current(), Thread::kVmWait);
+  ScopedThreadStateChange tsc(self, Thread::kVmWait);
   STLDeleteElements(&threads);
 }