Zygote space / partial collection support.

The zygote space is now created right before zygote fork. This space has new allocations into it disabled, this reduces memory usage since we have more shared pages.

Partial collection works by marking all the zygote space -> alloc space references by using a mod-union table and then recursively marking only over the alloc space.

Approximate improvements;

Deltablue time goes down ~0.5 seconds.

Caffeinemark score goes up ~300.

System memory usage goes down ~7MB.

Change-Id: I198389371d23deacd9b4534f39727eb641786b34
diff --git a/src/heap_bitmap.cc b/src/heap_bitmap.cc
index 7d81a5d..50a037b 100644
--- a/src/heap_bitmap.cc
+++ b/src/heap_bitmap.cc
@@ -1,16 +1,31 @@
 #include "heap_bitmap.h"
+#include "space.h"
 
 namespace art {
 
 void HeapBitmap::ReplaceBitmap(SpaceBitmap* old_bitmap, SpaceBitmap* new_bitmap) {
   // TODO: C++0x auto
-  for (Bitmaps::iterator cur  = bitmaps_.begin(); cur != bitmaps_.end(); ++cur) {
-    if (*cur == old_bitmap) {
-      *cur = new_bitmap;
+  for (Bitmaps::iterator it = bitmaps_.begin(); it != bitmaps_.end(); ++it) {
+    if (*it == old_bitmap) {
+      *it = new_bitmap;
       return;
     }
   }
   LOG(FATAL) << "bitmap " << static_cast<const void*>(old_bitmap) << " not found";
 }
 
+void HeapBitmap::AddSpaceBitmap(SpaceBitmap* bitmap) {
+  DCHECK(bitmap != NULL);
+
+  // Check for interval overlap.
+  for (Bitmaps::const_iterator it = bitmaps_.begin(); it != bitmaps_.end(); ++it) {
+    SpaceBitmap* cur_bitmap = *it;
+    if (bitmap->HeapBegin() < cur_bitmap->HeapSize() + cur_bitmap->HeapSize() &&
+        bitmap->HeapBegin() + bitmap->HeapSize() > cur_bitmap->HeapBegin()) {
+      LOG(FATAL) << "Overlapping space bitmaps added to heap bitmap!";
+    }
+  }
+  bitmaps_.push_back(bitmap);
+}
+
 }  // namespace art