More of the concurrent copying collector.

Bug: 12687968
Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc
index 4643d14..40417d8 100644
--- a/runtime/java_vm_ext.cc
+++ b/runtime/java_vm_ext.cc
@@ -550,6 +550,13 @@
   weak_globals_add_condition_.Broadcast(self);
 }
 
+void JavaVMExt::EnsureNewWeakGlobalsDisallowed() {
+  // Lock and unlock once to ensure that no threads are still in the
+  // middle of adding new weak globals.
+  MutexLock mu(Thread::Current(), weak_globals_lock_);
+  CHECK(!allow_new_weak_globals_);
+}
+
 mirror::Object* JavaVMExt::DecodeGlobal(Thread* self, IndirectRef ref) {
   return globals_.SynchronizedGet(self, &globals_lock_, ref);
 }