Make sure threads allocating are in the kRunnable state

Change-Id: I55a08fcd38b3388698ef571d2d4fa9553210e197
diff --git a/src/heap.cc b/src/heap.cc
index bef71ae..9e356d1 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -323,6 +323,10 @@
 Object* Heap::AllocateLocked(Space* space, size_t size) {
   lock_->AssertHeld();
 
+  // Since allocation can cause a GC which will need to SuspendAll,
+  // make sure all allocators are in the kRunnable state.
+  DCHECK_EQ(Thread::Current()->GetState(), Thread::kRunnable);
+
   // Fail impossible allocations.  TODO: collect soft references.
   if (size > maximum_size_) {
     return NULL;