Make the support code for read barriers a bit more general.
Add an option for Baker in addition to Brooks.
Bug: 12687968
Change-Id: I8a31db817ff6686c72951b6534f588228e270b11
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 6824183..0405198 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -610,11 +610,13 @@
void ImageWriter::FixupObject(Object* orig, Object* copy) {
DCHECK(orig != nullptr);
DCHECK(copy != nullptr);
- if (kUseBrooksPointer) {
- orig->AssertSelfBrooksPointer();
- // Note the address 'copy' isn't the same as the image address of 'orig'.
- copy->SetBrooksPointer(GetImageAddress(orig));
- DCHECK_EQ(copy->GetBrooksPointer(), GetImageAddress(orig));
+ if (kUseBakerOrBrooksReadBarrier) {
+ orig->AssertReadBarrierPointer();
+ if (kUseBrooksReadBarrier) {
+ // Note the address 'copy' isn't the same as the image address of 'orig'.
+ copy->SetReadBarrierPointer(GetImageAddress(orig));
+ DCHECK_EQ(copy->GetReadBarrierPointer(), GetImageAddress(orig));
+ }
}
FixupVisitor visitor(this, copy);
orig->VisitReferences<true /*visit class*/>(visitor, visitor);