Enable ART_USE_READ_BARRIER by default (test only)

This is only for cherrypick for performance testing.

Bug: 31528287
Bug: 12687968
Test: angler boot, test-art-host
Change-Id: Ife1eae7779b5acc5e45baaafdfdbd1bc875188d6
diff --git a/build/Android.common_build.mk b/build/Android.common_build.mk
index 7edc1cc..1ce57b6 100644
--- a/build/Android.common_build.mk
+++ b/build/Android.common_build.mk
@@ -70,6 +70,9 @@
 $(info Enabling ART_BUILD_HOST_STATIC)
 endif
 
+# Enable the read barrier by default.
+ART_USE_READ_BARRIER ?= true
+
 ifeq ($(ART_TEST_DEBUG_GC),true)
   ART_DEFAULT_GC_TYPE := SS
   ART_USE_TLAB := true
diff --git a/build/art.go b/build/art.go
index f2efbfe..f1836bb 100644
--- a/build/art.go
+++ b/build/art.go
@@ -56,7 +56,7 @@
 		asflags = append(asflags, "-DART_HEAP_POISONING=1")
 	}
 
-	if envTrue(ctx, "ART_USE_READ_BARRIER") {
+	if !envFalse(ctx, "ART_USE_READ_BARRIER") {
 		// Used to change the read barrier type. Valid values are BAKER, BROOKS, TABLELOOKUP.
 		// The default is BAKER.
 		barrierType := envDefault(ctx, "ART_READ_BARRIER_TYPE", "BAKER")
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index d12bd79..1e258db 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -42,7 +42,7 @@
 SECONDARY_DEX=""
 TIME_OUT="gdb"  # "n" (disabled), "timeout" (use timeout), "gdb" (use gdb)
 # Value in seconds
-if [ "$ART_USE_READ_BARRIER" = "true" ]; then
+if [ "$ART_USE_READ_BARRIER" != "false" ]; then
   TIME_OUT_VALUE=1800  # 30 minutes.
 else
   TIME_OUT_VALUE=1200  # 20 minutes.
diff --git a/test/run-test b/test/run-test
index 8fb2adf..798385c 100755
--- a/test/run-test
+++ b/test/run-test
@@ -686,7 +686,7 @@
     #
     # TODO: Enable Checker when read barrier support is added to more
     # architectures (b/12687968).
-    if [ "x$ART_USE_READ_BARRIER" = xtrue ]                    \
+    if [ "x$ART_USE_READ_BARRIER" != xfalse ]                  \
        && (([ "x$host_mode" = "xyes" ]                         \
             && ! arch_supports_read_barrier "$host_arch_name") \
            || ([ "x$target_mode" = "xyes" ]                    \
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index 01c7f20..807d657 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -43,7 +43,7 @@
 done
 
 expectations="--expectations art/tools/libcore_failures.txt"
-if [ "x$ART_USE_READ_BARRIER" = xtrue ]; then
+if [ "x$ART_USE_READ_BARRIER" != xfalse ]; then
   # Tolerate some more failures on the concurrent collector configurations.
   expectations="$expectations --expectations art/tools/libcore_failures_concurrent_collector.txt"
 fi