Add -Release ASAN bots.

These may be better at -fsanitize=object-size.

No need to loop more than once in nanobench for these bots.

CQ_INCLUDE_TRYBOTS=skia.primary:Build-Ubuntu-Clang-x86_64-Release-ASAN,Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN,Perf-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN,Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN,Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN

Change-Id: If89e94390d473434717cfe28de6be9055b68d8d4
Reviewed-on: https://skia-review.googlesource.com/7278
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 7e05319..4a058be 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -71,8 +71,12 @@
 
 static const int kAutoTuneLoops = 0;
 
+#if !defined(__has_feature)
+    #define  __has_feature(x) 0
+#endif
+
 static const int kDefaultLoops =
-#ifdef SK_DEBUG
+#if defined(SK_DEBUG) || __has_feature(address_sanitizer)
     1;
 #else
     kAutoTuneLoops;
diff --git a/infra/bots/gen_tasks.go b/infra/bots/gen_tasks.go
index 0b574eb..61b0900 100644
--- a/infra/bots/gen_tasks.go
+++ b/infra/bots/gen_tasks.go
@@ -68,6 +68,7 @@
 		"Build-Ubuntu-Clang-x86_64-Debug-MSAN",
 		"Build-Ubuntu-Clang-x86_64-Debug-Vulkan",
 		"Build-Ubuntu-Clang-x86_64-Release",
+		"Build-Ubuntu-Clang-x86_64-Release-ASAN",
 		"Build-Ubuntu-Clang-x86_64-Release-Fast",
 		"Build-Ubuntu-Clang-x86_64-Release-TSAN",
 		"Build-Ubuntu-Clang-x86_64-Release-Vulkan",
@@ -151,8 +152,10 @@
 		"Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN",
 		"Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN",
 		"Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release",
+		"Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN",
 		"Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-Fast",
 		"Perf-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Debug-ASAN",
+		"Perf-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN",
 		"Perf-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug",
 		"Perf-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug",
 		"Perf-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE",
@@ -247,9 +250,11 @@
 		"Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN",
 		"Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN",
 		"Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release",
+		"Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN",
 		"Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-Fast",
 		"Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-TSAN",
 		"Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Debug-ASAN",
+		"Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN",
 		"Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-TSAN",
 		"Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug",
 		"Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug",
diff --git a/infra/bots/tasks.json b/infra/bots/tasks.json
index 4ca00b0..de6e96d 100644
--- a/infra/bots/tasks.json
+++ b/infra/bots/tasks.json
@@ -180,6 +180,12 @@
         "Build-Ubuntu-Clang-x86_64-Release"
       ]
     },
+    "Build-Ubuntu-Clang-x86_64-Release-ASAN": {
+      "priority": 0.8,
+      "tasks": [
+        "Build-Ubuntu-Clang-x86_64-Release-ASAN"
+      ]
+    },
     "Build-Ubuntu-Clang-x86_64-Release-Fast": {
       "priority": 0.8,
       "tasks": [
@@ -668,6 +674,12 @@
         "Upload-Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release"
       ]
     },
+    "Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN": {
+      "priority": 0.8,
+      "tasks": [
+        "Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN"
+      ]
+    },
     "Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-Fast": {
       "priority": 0.8,
       "tasks": [
@@ -680,6 +692,12 @@
         "Perf-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Debug-ASAN"
       ]
     },
+    "Perf-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN": {
+      "priority": 0.8,
+      "tasks": [
+        "Perf-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN"
+      ]
+    },
     "Perf-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug": {
       "priority": 0.8,
       "tasks": [
@@ -1232,6 +1250,12 @@
         "Upload-Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release"
       ]
     },
+    "Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN": {
+      "priority": 0.8,
+      "tasks": [
+        "Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN"
+      ]
+    },
     "Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-Fast": {
       "priority": 0.8,
       "tasks": [
@@ -1250,6 +1274,12 @@
         "Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Debug-ASAN"
       ]
     },
+    "Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN": {
+      "priority": 0.8,
+      "tasks": [
+        "Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN"
+      ]
+    },
     "Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-TSAN": {
       "priority": 0.8,
       "tasks": [
@@ -2481,6 +2511,38 @@
       "isolate": "compile_skia.isolate",
       "priority": 0.8
     },
+    "Build-Ubuntu-Clang-x86_64-Release-ASAN": {
+      "cipd_packages": [
+        {
+          "name": "skia/bots/clang_linux",
+          "path": "clang_linux",
+          "version": "version:4"
+        }
+      ],
+      "dimensions": [
+        "gpu:none",
+        "os:Ubuntu-14.04",
+        "pool:Skia"
+      ],
+      "extra_args": [
+        "--workdir",
+        "../../..",
+        "swarm_compile",
+        "repository=<(REPO)",
+        "buildername=Build-Ubuntu-Clang-x86_64-Release-ASAN",
+        "mastername=fake-master",
+        "buildnumber=2",
+        "slavename=fake-buildslave",
+        "nobuildbot=True",
+        "swarm_out_dir=${ISOLATED_OUTDIR}",
+        "revision=<(REVISION)",
+        "patch_storage=<(PATCH_STORAGE)",
+        "patch_issue=<(ISSUE)",
+        "patch_set=<(PATCHSET)"
+      ],
+      "isolate": "compile_skia.isolate",
+      "priority": 0.8
+    },
     "Build-Ubuntu-Clang-x86_64-Release-Fast": {
       "cipd_packages": [
         {
@@ -5713,6 +5775,60 @@
       "isolate": "perf_skia.isolate",
       "priority": 0.8
     },
+    "Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN": {
+      "cipd_packages": [
+        {
+          "name": "skia/bots/skimage",
+          "path": "skimage",
+          "version": "version:19"
+        },
+        {
+          "name": "skia/bots/skp",
+          "path": "skp",
+          "version": "version:33"
+        },
+        {
+          "name": "skia/bots/svg",
+          "path": "svg",
+          "version": "version:3"
+        },
+        {
+          "name": "skia/bots/clang_linux",
+          "path": "clang_linux",
+          "version": "version:4"
+        }
+      ],
+      "dependencies": [
+        "Build-Ubuntu-Clang-x86_64-Release-ASAN"
+      ],
+      "dimensions": [
+        "cpu:x86-64-avx2",
+        "gpu:none",
+        "os:Ubuntu-14.04",
+        "pool:Skia"
+      ],
+      "execution_timeout_ns": 14400000000000,
+      "expiration_ns": 72000000000000,
+      "extra_args": [
+        "--workdir",
+        "../../..",
+        "swarm_perf",
+        "repository=<(REPO)",
+        "buildername=Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN",
+        "mastername=fake-master",
+        "buildnumber=2",
+        "slavename=fake-buildslave",
+        "nobuildbot=True",
+        "swarm_out_dir=${ISOLATED_OUTDIR}",
+        "revision=<(REVISION)",
+        "patch_storage=<(PATCH_STORAGE)",
+        "patch_issue=<(ISSUE)",
+        "patch_set=<(PATCHSET)"
+      ],
+      "io_timeout_ns": 2400000000000,
+      "isolate": "perf_skia.isolate",
+      "priority": 0.8
+    },
     "Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-Fast": {
       "cipd_packages": [
         {
@@ -5815,6 +5931,59 @@
       "isolate": "perf_skia.isolate",
       "priority": 0.8
     },
+    "Perf-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN": {
+      "cipd_packages": [
+        {
+          "name": "skia/bots/skimage",
+          "path": "skimage",
+          "version": "version:19"
+        },
+        {
+          "name": "skia/bots/skp",
+          "path": "skp",
+          "version": "version:33"
+        },
+        {
+          "name": "skia/bots/svg",
+          "path": "svg",
+          "version": "version:3"
+        },
+        {
+          "name": "skia/bots/clang_linux",
+          "path": "clang_linux",
+          "version": "version:4"
+        }
+      ],
+      "dependencies": [
+        "Build-Ubuntu-Clang-x86_64-Release-ASAN"
+      ],
+      "dimensions": [
+        "gpu:10de:104a",
+        "os:Ubuntu-14.04",
+        "pool:Skia"
+      ],
+      "execution_timeout_ns": 14400000000000,
+      "expiration_ns": 72000000000000,
+      "extra_args": [
+        "--workdir",
+        "../../..",
+        "swarm_perf",
+        "repository=<(REPO)",
+        "buildername=Perf-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN",
+        "mastername=fake-master",
+        "buildnumber=2",
+        "slavename=fake-buildslave",
+        "nobuildbot=True",
+        "swarm_out_dir=${ISOLATED_OUTDIR}",
+        "revision=<(REVISION)",
+        "patch_storage=<(PATCH_STORAGE)",
+        "patch_issue=<(ISSUE)",
+        "patch_set=<(PATCHSET)"
+      ],
+      "io_timeout_ns": 2400000000000,
+      "isolate": "perf_skia.isolate",
+      "priority": 0.8
+    },
     "Perf-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug": {
       "cipd_packages": [
         {
@@ -10242,6 +10411,60 @@
       "isolate": "test_skia.isolate",
       "priority": 0.8
     },
+    "Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN": {
+      "cipd_packages": [
+        {
+          "name": "skia/bots/skimage",
+          "path": "skimage",
+          "version": "version:19"
+        },
+        {
+          "name": "skia/bots/skp",
+          "path": "skp",
+          "version": "version:33"
+        },
+        {
+          "name": "skia/bots/svg",
+          "path": "svg",
+          "version": "version:3"
+        },
+        {
+          "name": "skia/bots/clang_linux",
+          "path": "clang_linux",
+          "version": "version:4"
+        }
+      ],
+      "dependencies": [
+        "Build-Ubuntu-Clang-x86_64-Release-ASAN"
+      ],
+      "dimensions": [
+        "cpu:x86-64-avx2",
+        "gpu:none",
+        "os:Ubuntu-14.04",
+        "pool:Skia"
+      ],
+      "execution_timeout_ns": 14400000000000,
+      "expiration_ns": 72000000000000,
+      "extra_args": [
+        "--workdir",
+        "../../..",
+        "swarm_test",
+        "repository=<(REPO)",
+        "buildername=Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-ASAN",
+        "mastername=fake-master",
+        "buildnumber=2",
+        "slavename=fake-buildslave",
+        "nobuildbot=True",
+        "swarm_out_dir=${ISOLATED_OUTDIR}",
+        "revision=<(REVISION)",
+        "patch_storage=<(PATCH_STORAGE)",
+        "patch_issue=<(ISSUE)",
+        "patch_set=<(PATCHSET)"
+      ],
+      "io_timeout_ns": 2400000000000,
+      "isolate": "test_skia.isolate",
+      "priority": 0.8
+    },
     "Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-Fast": {
       "cipd_packages": [
         {
@@ -10398,6 +10621,59 @@
       "isolate": "test_skia.isolate",
       "priority": 0.8
     },
+    "Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN": {
+      "cipd_packages": [
+        {
+          "name": "skia/bots/skimage",
+          "path": "skimage",
+          "version": "version:19"
+        },
+        {
+          "name": "skia/bots/skp",
+          "path": "skp",
+          "version": "version:33"
+        },
+        {
+          "name": "skia/bots/svg",
+          "path": "svg",
+          "version": "version:3"
+        },
+        {
+          "name": "skia/bots/clang_linux",
+          "path": "clang_linux",
+          "version": "version:4"
+        }
+      ],
+      "dependencies": [
+        "Build-Ubuntu-Clang-x86_64-Release-ASAN"
+      ],
+      "dimensions": [
+        "gpu:10de:104a",
+        "os:Ubuntu-14.04",
+        "pool:Skia"
+      ],
+      "execution_timeout_ns": 14400000000000,
+      "expiration_ns": 72000000000000,
+      "extra_args": [
+        "--workdir",
+        "../../..",
+        "swarm_test",
+        "repository=<(REPO)",
+        "buildername=Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-ASAN",
+        "mastername=fake-master",
+        "buildnumber=2",
+        "slavename=fake-buildslave",
+        "nobuildbot=True",
+        "swarm_out_dir=${ISOLATED_OUTDIR}",
+        "revision=<(REVISION)",
+        "patch_storage=<(PATCH_STORAGE)",
+        "patch_issue=<(ISSUE)",
+        "patch_set=<(PATCHSET)"
+      ],
+      "io_timeout_ns": 2400000000000,
+      "isolate": "test_skia.isolate",
+      "priority": 0.8
+    },
     "Test-Ubuntu-Clang-Golo-GPU-GT610-x86_64-Release-TSAN": {
       "cipd_packages": [
         {