Some fixes for the CC collector.

- Remove a DCHECK in DisableMarkingCheckpoint, which caused
  occasional (false) failures.
- Check the thread-local GetWeakRefAccessEnabled in boxed lambdas weak
  access.
- Add missing BroadcastForNewAllocationRecords and
  BroadcastForNewWeakBoxedLambdas. The lack of the former caused
  occasional deadlocks in the ddmc test.
- Remove the 'ensure system weaks disallowed' calls, which weren't
  useful and dead.

Bug: 12687968
Change-Id: I33850c8d12e6e1a3aed1c2bb18eba263cbab76e8
diff --git a/runtime/lambda/box_table.cc b/runtime/lambda/box_table.cc
index 64a6076..26575fd 100644
--- a/runtime/lambda/box_table.cc
+++ b/runtime/lambda/box_table.cc
@@ -139,7 +139,8 @@
 
 void BoxTable::BlockUntilWeaksAllowed() {
   Thread* self = Thread::Current();
-  while (UNLIKELY(allow_new_weaks_ == false)) {
+  while (UNLIKELY((!kUseReadBarrier && !allow_new_weaks_) ||
+                  (kUseReadBarrier && !self->GetWeakRefAccessEnabled()))) {
     new_weaks_condition_.WaitHoldingLocks(self);  // wait while holding mutator lock
   }
 }
@@ -184,6 +185,7 @@
 }
 
 void BoxTable::DisallowNewWeakBoxedLambdas() {
+  CHECK(!kUseReadBarrier);
   Thread* self = Thread::Current();
   MutexLock mu(self, *Locks::lambda_table_lock_);
 
@@ -191,6 +193,7 @@
 }
 
 void BoxTable::AllowNewWeakBoxedLambdas() {
+  CHECK(!kUseReadBarrier);
   Thread* self = Thread::Current();
   MutexLock mu(self, *Locks::lambda_table_lock_);
 
@@ -198,10 +201,11 @@
   new_weaks_condition_.Broadcast(self);
 }
 
-void BoxTable::EnsureNewWeakBoxedLambdasDisallowed() {
+void BoxTable::BroadcastForNewWeakBoxedLambdas() {
+  CHECK(kUseReadBarrier);
   Thread* self = Thread::Current();
   MutexLock mu(self, *Locks::lambda_table_lock_);
-  CHECK_NE(allow_new_weaks_, false);
+  new_weaks_condition_.Broadcast(self);
 }
 
 bool BoxTable::EqualsFn::operator()(const ClosureType& lhs, const ClosureType& rhs) const {