Bump pointer space only collection.

Add a mode of collection that collects only the bump pointer spaces,
as opposed to the whole heap. It's disabled behind a flag.

TODO: It still scans the entire non-moving space to look for
inter-space references. Use a card table like technique to limit the
scope of scanning and speed it up.

Bug: 11650816
Change-Id: I56cb11e78e47a578bff644e6e6c63d978cfedf39
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index cc4d7be..465ee4c 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -495,6 +495,21 @@
     return large_object_space_;
   }
 
+  // Returns the free list space that may contain movable objects (the
+  // one that's not the non-moving space), either rosalloc_space_ or
+  // dlmalloc_space_.
+  space::MallocSpace* GetPrimaryFreeListSpace() {
+    if (kUseRosAlloc) {
+      DCHECK(rosalloc_space_ != nullptr);
+      // reinterpret_cast is necessary as the space class hierarchy
+      // isn't known (#included) yet here.
+      return reinterpret_cast<space::MallocSpace*>(rosalloc_space_);
+    } else {
+      DCHECK(dlmalloc_space_ != nullptr);
+      return reinterpret_cast<space::MallocSpace*>(dlmalloc_space_);
+    }
+  }
+
   void DumpSpaces(std::ostream& stream = LOG(INFO));
 
   // GC performance measuring