Clear zygote space cards for CC

There may be dirty cards from reference processing or from zygote
compaction. Having these dirty cards in the zygote space is
unnecessary and causes PSS increase from GrayAllDirtyImmuneObjects
in future GCs. Clearing the zygote space cards when the zygote
space is created fixes this issue and reduces PSS.

System wide PSS for zygote space, before:
7,899K: .Zygote
7,896K: .Zygote
8,067K: .Zygote
8,547K: .Zygote

After:
4,881K: .Zygote
5,003K: .Zygote
5,582K: .Zygote
5,259K: .Zygote
5,176K: .Zygote

Bug: 12687968
Bug: 37219911

Test: Device boots
Test: test-art-host

(cherry picked from commit d5a67447de577546b76c0565aed5af56176bbeb4)

Change-Id: I3f61b0f26674a8434ee37925fefd3480b106857d
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index f04bc89..357541f 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -2542,6 +2542,13 @@
     // to large objects.
     mod_union_table->SetCards();
   } else {
+    // Make sure to clear the zygote space cards so that we don't dirty pages in the next GC. There
+    // may be dirty cards from the zygote compaction or reference processing. These cards are not
+    // necessary to have marked since the zygote space may not refer to any objects not in the
+    // zygote or image spaces at this point.
+    mod_union_table->ProcessCards();
+    mod_union_table->ClearTable();
+
     // For CC we never collect zygote large objects. This means we do not need to set the cards for
     // the zygote mod-union table and we can also clear all of the existing image mod-union tables.
     // The existing mod-union tables are only for image spaces and may only reference zygote and