(Experimental) Add Brooks pointers.

This feature is disabled by default.

Verified that the Brooks pointers are installed correctly by using the
CMS/SS collectors.

Change-Id: Ia9be9814ab6e29169ac85edc4792ce8c81d552a9
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index c8447be..aa16885 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -583,6 +583,12 @@
   DCHECK(orig != NULL);
   DCHECK(copy != NULL);
   copy->SetClass<kVerifyNone>(down_cast<Class*>(GetImageAddress(orig->GetClass())));
+  if (kUseBrooksPointer) {
+    orig->AssertSelfBrooksPointer();
+    // Note the address 'copy' isn't the same as the image address of 'orig'.
+    copy->SetBrooksPointer(GetImageAddress(orig));
+    DCHECK(copy->GetBrooksPointer() == GetImageAddress(orig));
+  }
   // TODO: special case init of pointers to malloc data (or removal of these pointers)
   if (orig->IsClass<kVerifyNone>()) {
     FixupClass(orig->AsClass<kVerifyNone>(), down_cast<Class*>(copy));