Remove first GC pause.

Fixed error where we were prefetching the address of address of
objects.

Remove first paused by removing get dirty cards and replacing it
with card aging. We now age the cards before doing the checkpoint
instead of clearing them. This lets us know which cards were
dirtied before the start of the GC and which cards were dirtied
after.

Optimized FreeList slightly.

Change-Id: I39d6aac1839476d7541d83970c8b27b266e8a117
diff --git a/src/gc/mark_sweep.h b/src/gc/mark_sweep.h
index f510943..2297ce1 100644
--- a/src/gc/mark_sweep.h
+++ b/src/gc/mark_sweep.h
@@ -82,7 +82,7 @@
       EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_);
 
   // Builds a mark stack with objects on dirty cards and recursively mark until it empties.
-  void RecursiveMarkDirtyObjects()
+  void RecursiveMarkDirtyObjects(byte minimum_age = CardTable::kCardDirty)
       EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
@@ -165,7 +165,7 @@
         ++other_count_;
       }
       VisitOtherReferences(klass, obj, visitor);
-      if (klass->IsReferenceClass()) {
+      if (UNLIKELY(klass->IsReferenceClass())) {
         DelayReferenceReferent(const_cast<Object*>(obj));
       }
     }
@@ -329,9 +329,8 @@
   template <typename Visitor>
   static void VisitFieldsReferences(const Object* obj, uint32_t ref_offsets, bool is_static,
                              const Visitor& visitor)
-      SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_,
-                            Locks::mutator_lock_) {
-    if (ref_offsets != CLASS_WALK_SUPER) {
+      SHARED_LOCKS_REQUIRED(Locks::heap_bitmap_lock_, Locks::mutator_lock_) {
+    if (LIKELY(ref_offsets != CLASS_WALK_SUPER)) {
       // Found a reference offset bitmap.  Mark the specified offsets.
       while (ref_offsets != 0) {
         size_t right_shift = CLZ(ref_offsets);
@@ -386,8 +385,9 @@
   }
 
   // Blackens objects grayed during a garbage collection.
-  void ScanGrayObjects()
-      EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_);
+  void ScanGrayObjects(byte minimum_age)
+      EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
   // Schedules an unmarked object for reference processing.
   void DelayReferenceReferent(Object* reference)
@@ -459,6 +459,7 @@
   AtomicInteger overhead_time_;
   AtomicInteger work_chunks_created_;
   AtomicInteger work_chunks_deleted_;
+  AtomicInteger reference_count_;
 
   UniquePtr<Barrier> gc_barrier_;
   Mutex large_object_lock_;