Enable "disallow read barriers" checks in debug mode.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 194017033
Change-Id: I4657cfa878de227cb5fb35ae888679d5c590f9f0
diff --git a/runtime/read_barrier_config.h b/runtime/read_barrier_config.h
index d6b9cb3..d505bed 100644
--- a/runtime/read_barrier_config.h
+++ b/runtime/read_barrier_config.h
@@ -46,6 +46,8 @@
 
 #ifdef __cplusplus
 
+#include "base/globals.h"
+
 namespace art {
 
 #ifdef USE_BAKER_READ_BARRIER
@@ -73,7 +75,7 @@
 static constexpr bool kEmitCompilerReadBarrier = kForceReadBarrier || kUseReadBarrier;
 
 // Disabled for performance reasons.
-static constexpr bool kCheckDebugDisallowReadBarrierCount = false;
+static constexpr bool kCheckDebugDisallowReadBarrierCount = kIsDebugBuild;
 
 }  // namespace art