Pass current thread as argument to alloc instrumentation.

Avoids recomputation in the hot allocation path when instrumentation is
enabled.

Change-Id: Ic6e7d7d0744f4756787f75d21fddd3c50280b588
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 50bb0c9..c8bb537 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -4375,10 +4375,7 @@
   size_t depth;
 };
 
-void Dbg::RecordAllocation(mirror::Class* type, size_t byte_count) {
-  Thread* self = Thread::Current();
-  CHECK(self != nullptr);
-
+void Dbg::RecordAllocation(Thread* self, mirror::Class* type, size_t byte_count) {
   MutexLock mu(self, *Locks::alloc_tracker_lock_);
   if (recent_allocation_records_ == nullptr) {
     // In the process of shutting down recording, bail.
diff --git a/runtime/debugger.h b/runtime/debugger.h
index 3e16288..219210e 100644
--- a/runtime/debugger.h
+++ b/runtime/debugger.h
@@ -561,7 +561,7 @@
   /*
    * Recent allocation tracking support.
    */
-  static void RecordAllocation(mirror::Class* type, size_t byte_count)
+  static void RecordAllocation(Thread* self, mirror::Class* type, size_t byte_count)
       LOCKS_EXCLUDED(Locks::alloc_tracker_lock_)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
   static void SetAllocTrackingEnabled(bool enabled) LOCKS_EXCLUDED(Locks::alloc_tracker_lock_);
diff --git a/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h
index d1fb600..c971449 100644
--- a/runtime/gc/heap-inl.h
+++ b/runtime/gc/heap-inl.h
@@ -140,7 +140,7 @@
   }
   if (kInstrumented) {
     if (Dbg::IsAllocTrackingEnabled()) {
-      Dbg::RecordAllocation(klass, bytes_allocated);
+      Dbg::RecordAllocation(self, klass, bytes_allocated);
     }
   } else {
     DCHECK(!Dbg::IsAllocTrackingEnabled());