Fix and re-enable CMS

Fix for CardTable::Scan double length scan which caused occasional assert failures.
Fix for the case where CMS request JNI code caused a GC which freed newest allocated object.
Fix error with is_gc_running_ never being set and deadlock due to CV wait without thread state change.
Fix error where we were Unlocking the heap before doing ResumeAll in CollectGarbageInternal which resulted in a rare race condition.
Fix error where GC could be in progress when the runtime terminated.

Change-Id: I8d243d4dca63170433a63429442788ecb09e55fe
diff --git a/src/mark_sweep.cc b/src/mark_sweep.cc
index 45ad0fe..25b5c6b 100644
--- a/src/mark_sweep.cc
+++ b/src/mark_sweep.cc
@@ -159,7 +159,7 @@
     // Normally, we only need to scan the black dirty objects
     // But for image spaces, the roots will not be black objects.
     // To address this we just scan the live bits instead of the mark bits.
-    if (UNLIKELY(spaces[i]->IsImageSpace())) {
+    if (spaces[i]->IsImageSpace()) {
       // Image roots may not be marked so we may need to mark them.
       // TODO: optimize this by offsetting some of the work to init.
       card_table->Scan(heap_->GetLiveBits(), begin, end, ScanImageRootVisitor, this);