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/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h
index 8bfe793..25f20d6 100644
--- a/runtime/gc/heap-inl.h
+++ b/runtime/gc/heap-inl.h
@@ -73,9 +73,11 @@
DCHECK_GT(bytes_allocated, 0u);
DCHECK_GT(usable_size, 0u);
obj->SetClass(klass);
- if (kUseBrooksPointer) {
- obj->SetBrooksPointer(obj);
- obj->AssertSelfBrooksPointer();
+ if (kUseBakerOrBrooksReadBarrier) {
+ if (kUseBrooksReadBarrier) {
+ obj->SetReadBarrierPointer(obj);
+ }
+ obj->AssertReadBarrierPointer();
}
if (collector::SemiSpace::kUseRememberedSet && UNLIKELY(allocator == kAllocatorTypeNonMoving)) {
// (Note this if statement will be constant folded away for the