ART: clear dirty cards of alloc space for MS/CMS partial and full GCs

For MS/CMS partial and full GCs, we could clear the dirty cards of alloc
space when we process cards as we care about the dirty cards after GC
starts.

Change-Id: I1f9b32b20d75979387bc5d26b0cf9a256dcf20b6
Signed-off-by: Lei Li <lei.l.li@intel.com>
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index 04fb694..64d2cc4 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -217,7 +217,7 @@
     Thread* self = Thread::Current();
     CHECK(!Locks::mutator_lock_->IsExclusiveHeld(self));
     // Process dirty cards and add dirty cards to mod union tables, also ages cards.
-    heap_->ProcessCards(GetTimings(), false);
+    heap_->ProcessCards(GetTimings(), false, true, false);
     // The checkpoint root marking is required to avoid a race condition which occurs if the
     // following happens during a reference write:
     // 1. mutator dirties the card (write barrier)
@@ -255,7 +255,8 @@
   BindBitmaps();
   FindDefaultSpaceBitmap();
   // Process dirty cards and add dirty cards to mod union tables.
-  heap_->ProcessCards(GetTimings(), false);
+  // If the GC type is non sticky, then we just clear the cards instead of ageing them.
+  heap_->ProcessCards(GetTimings(), false, true, GetGcType() != kGcTypeSticky);
   WriterMutexLock mu(self, *Locks::heap_bitmap_lock_);
   MarkRoots(self);
   MarkReachableObjects();