Avoid debug check violation in thread registration.

Bug: 13757855
Change-Id: Ied83a7fc43e2b9a89a8b99aa4f74069ef8a369b1
diff --git a/runtime/thread.cc b/runtime/thread.cc
index b802882..29d011c 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -598,12 +598,14 @@
 }
 
 void Thread::ModifySuspendCount(Thread* self, int delta, bool for_debugger) {
-  DCHECK(delta == -1 || delta == +1 || delta == -tls32_.debug_suspend_count)
-      << delta << " " << tls32_.debug_suspend_count << " " << this;
-  DCHECK_GE(tls32_.suspend_count, tls32_.debug_suspend_count) << this;
-  Locks::thread_suspend_count_lock_->AssertHeld(self);
-  if (this != self && !IsSuspended()) {
-    Locks::thread_list_lock_->AssertHeld(self);
+  if (kIsDebugBuild) {
+    DCHECK(delta == -1 || delta == +1 || delta == -tls32_.debug_suspend_count)
+          << delta << " " << tls32_.debug_suspend_count << " " << this;
+    DCHECK_GE(tls32_.suspend_count, tls32_.debug_suspend_count) << this;
+    Locks::thread_suspend_count_lock_->AssertHeld(self);
+    if (this != self && !IsSuspended()) {
+      Locks::thread_list_lock_->AssertHeld(self);
+    }
   }
   if (UNLIKELY(delta < 0 && tls32_.suspend_count <= 0)) {
     UnsafeLogFatalForSuspendCount(self, this);