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/collector/semi_space.h b/runtime/gc/collector/semi_space.h
index 16c1329..ba9f0f6 100644
--- a/runtime/gc/collector/semi_space.h
+++ b/runtime/gc/collector/semi_space.h
@@ -263,6 +263,9 @@
   mirror::Object* immune_begin_;
   mirror::Object* immune_end_;
 
+  // If true, the large object space is immune.
+  bool is_large_object_space_immune_;
+
   // Destination and source spaces (can be any type of ContinuousMemMapAllocSpace which either has
   // a live bitmap or doesn't).
   space::ContinuousMemMapAllocSpace* to_space_;
@@ -280,6 +283,18 @@
   // pointer space to the non-moving space.
   uint64_t bytes_promoted_;
 
+  // When true, collect the whole heap. When false, collect only the
+  // bump pointer spaces.
+  bool whole_heap_collection_;
+
+  // A counter used to enable whole_heap_collection_ once per
+  // interval.
+  int whole_heap_collection_interval_counter_;
+
+  // The default interval of the whole heap collection. If N, the
+  // whole heap collection occurs every N collections.
+  static constexpr int kDefaultWholeHeapCollectionInterval = 5;
+
  private:
   DISALLOW_COPY_AND_ASSIGN(SemiSpace);
 };