ART: Remove suspend-check optimization

This code has been untested and dead for a while. Remove it.

Test: m (bullhead)
Test: m (aosp_mips64)
Change-Id: Ib44597830c4be4db97420c910e716048308e9afa
diff --git a/runtime/arch/arm/asm_support_arm.h b/runtime/arch/arm/asm_support_arm.h
index 3d85872..ac17303 100644
--- a/runtime/arch/arm/asm_support_arm.h
+++ b/runtime/arch/arm/asm_support_arm.h
@@ -56,7 +56,4 @@
 #define BAKER_MARK_INTROSPECTION_GC_ROOT_LDR_WIDE_OFFSET -8
 #define BAKER_MARK_INTROSPECTION_GC_ROOT_LDR_NARROW_OFFSET -6
 
-// Flag for enabling R4 optimization in arm runtime
-// #define ARM_R4_SUSPEND_FLAG
-
 #endif  // ART_RUNTIME_ARCH_ARM_ASM_SUPPORT_ARM_H_
diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S
index ab9ca84..6ff8dd6 100644
--- a/runtime/arch/arm/quick_entrypoints_arm.S
+++ b/runtime/arch/arm/quick_entrypoints_arm.S
@@ -571,10 +571,6 @@
     add    ip, ip, #4                      @ skip r0
     ldm    ip, {r1-r3}                     @ copy r1 - r3
 
-#ifdef ARM_R4_SUSPEND_FLAG
-    mov    r4, #SUSPEND_CHECK_INTERVAL     @ reset r4 to suspend check interval
-#endif
-
     REFRESH_MARKING_REGISTER
 
     ldr    ip, [r0, #ART_METHOD_QUICK_CODE_OFFSET_32]  @ get pointer to the code
@@ -1533,14 +1529,6 @@
      */
     .extern artTestSuspendFromCode
 ENTRY art_quick_test_suspend
-#ifdef ARM_R4_SUSPEND_FLAG
-    ldrh   rSUSPEND, [rSELF, #THREAD_FLAGS_OFFSET]
-    cbnz   rSUSPEND, 1f                         @ check Thread::Current()->suspend_count_ == 0
-    mov    rSUSPEND, #SUSPEND_CHECK_INTERVAL    @ reset rSUSPEND to SUSPEND_CHECK_INTERVAL
-    bx     lr                                   @ return if suspend_count_ == 0
-1:
-    mov    rSUSPEND, #SUSPEND_CHECK_INTERVAL    @ reset rSUSPEND to SUSPEND_CHECK_INTERVAL
-#endif
     SETUP_SAVE_EVERYTHING_FRAME r0, RUNTIME_SAVE_EVERYTHING_FOR_SUSPEND_CHECK_METHOD_OFFSET @ save everything for GC stack crawl
     mov    r0, rSELF
     bl     artTestSuspendFromCode               @ (Thread*)
diff --git a/runtime/arch/mips/quick_entrypoints_mips.S b/runtime/arch/mips/quick_entrypoints_mips.S
index 74e0a7a..f6204bd 100644
--- a/runtime/arch/mips/quick_entrypoints_mips.S
+++ b/runtime/arch/mips/quick_entrypoints_mips.S
@@ -971,7 +971,6 @@
     move  $fp, $sp              # save sp in fp
     .cfi_def_cfa_register 30
     move  $s1, $a3              # move managed thread pointer into s1
-    addiu $s0, $zero, SUSPEND_CHECK_INTERVAL  # reset s0 to suspend check interval
     addiu $t0, $a2, 4           # create space for ArtMethod* in frame.
     subu  $t0, $sp, $t0         # reserve & align *stack* to 16 bytes:
     srl   $t0, $t0, 4           #   native calling convention only aligns to 8B,
@@ -1131,7 +1130,6 @@
     move  $fp, $sp              # save sp in fp
     .cfi_def_cfa_register 30
     move  $s1, $a3              # move managed thread pointer into s1
-    addiu $s0, $zero, SUSPEND_CHECK_INTERVAL  # reset s0 to suspend check interval
     addiu $t0, $a2, 4           # create space for ArtMethod* in frame.
     subu  $t0, $sp, $t0         # reserve & align *stack* to 16 bytes:
     srl   $t0, $t0, 4           #   native calling convention only aligns to 8B,
@@ -2061,12 +2059,6 @@
      */
     .extern artTestSuspendFromCode
 ENTRY_NO_GP art_quick_test_suspend
-    lh     rSUSPEND, THREAD_FLAGS_OFFSET(rSELF)
-    bnez   rSUSPEND, 1f
-    addiu  rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL   # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
-    jalr   $zero, $ra
-    nop
-1:
     SETUP_SAVE_EVERYTHING_FRAME RUNTIME_SAVE_EVERYTHING_FOR_SUSPEND_CHECK_METHOD_OFFSET
                                                      # save everything for stack crawl
     la     $t9, artTestSuspendFromCode
diff --git a/runtime/arch/mips64/quick_entrypoints_mips64.S b/runtime/arch/mips64/quick_entrypoints_mips64.S
index 1817502..d4ad275 100644
--- a/runtime/arch/mips64/quick_entrypoints_mips64.S
+++ b/runtime/arch/mips64/quick_entrypoints_mips64.S
@@ -1052,7 +1052,6 @@
     sd     $a4, 0($sp)
     .cfi_rel_offset 8, 0
 
-    daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL   # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
     move   $s1, $a3              # move managed thread pointer into s1 (rSELF)
     move   $s8, $sp              # save sp in s8 (fp)
 
@@ -1155,7 +1154,6 @@
     sd     $a4, 0($sp)
     .cfi_rel_offset 8, 0
 
-    daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL   # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
     move   $s1, $a3              # move managed thread pointer into s1 (rSELF)
     move   $s8, $sp              # save sp in s8 (fp)
 
@@ -1975,12 +1973,6 @@
      */
     .extern artTestSuspendFromCode
 ENTRY_NO_GP art_quick_test_suspend
-    lh     rSUSPEND, THREAD_FLAGS_OFFSET(rSELF)
-    bne    rSUSPEND, $zero, 1f
-    daddiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL   # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
-    jalr   $zero, $ra
-    nop
-1:
     SETUP_SAVE_EVERYTHING_FRAME RUNTIME_SAVE_EVERYTHING_FOR_SUSPEND_CHECK_METHOD_OFFSET
                                               # save everything for stack crawl
     jal    artTestSuspendFromCode             # (Thread*)
diff --git a/runtime/asm_support.h b/runtime/asm_support.h
index a4e3459..e18f110 100644
--- a/runtime/asm_support.h
+++ b/runtime/asm_support.h
@@ -20,20 +20,6 @@
 #include "heap_poisoning.h"
 #include "read_barrier_config.h"
 
-#if defined(__arm__) || defined(__mips__)
-// In quick code for ARM and MIPS we make poor use of registers and perform frequent suspend
-// checks in the event of loop back edges. The SUSPEND_CHECK_INTERVAL constant is loaded into a
-// register at the point of an up-call or after handling a suspend check. It reduces the number of
-// loads of the TLS suspend check value by the given amount (turning it into a decrement and compare
-// of a register). This increases the time for a thread to respond to requests from GC and the
-// debugger, damaging GC performance and creating other unwanted artifacts. For example, this count
-// has the effect of making loops and Java code look cold in profilers, where the count is reset
-// impacts where samples will occur. Reducing the count as much as possible improves profiler
-// accuracy in tools like traceview.
-// TODO: get a compiler that can do a proper job of loop optimization and remove this.
-#define SUSPEND_CHECK_INTERVAL 96
-#endif
-
 // To generate tests related to the constants in this header, either define ADD_TEST_EQ before
 // including, or use asm_support_check.h.
 #ifndef ADD_TEST_EQ  // Allow #include-r to replace with their own.