ART: Make Touch's stack array smaller under ASAN

Under ASAN, especially on x86, there's a lot of overhead. To keep
below a single page, add a multiplier to the deduction.

(cherry picked from commit 6f1c7517a9e411e4000aa7b13743ed49e0c38bc0)

Bug: 31098551
Bug: 62952017
Test: m
Test: SANITIZE_HOST=address SANITIZE_TARGET=address m ; manual assembly inspection
Merged-In: I8c80181e0fc5c6f4a1d3c6544f1a0e1089bb0631
Change-Id: I8c80181e0fc5c6f4a1d3c6544f1a0e1089bb0631
(cherry picked from commit 07e87f8096035d434320c715b58fa353e925c072)
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 3f7c307..6b10dfc 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -569,7 +569,14 @@
       // Use a large local volatile array to ensure a large frame size. Do not use anything close
       // to a full page for ASAN. It would be nice to ensure the frame size is at most a page, but
       // there is no pragma support for this.
-      volatile char space[kPageSize - 256];
+      // Note: for ASAN we need to shrink the array a bit, as there's other overhead.
+      constexpr size_t kAsanMultiplier =
+#ifdef ADDRESS_SANITIZER
+          2u;
+#else
+          1u;
+#endif
+      volatile char space[kPageSize - (kAsanMultiplier * 256)];
       char sink ATTRIBUTE_UNUSED = space[zero];
       if (reinterpret_cast<uintptr_t>(space) >= target + kPageSize) {
         Touch(target);