Pass the logger to the JIT compiler.

To avoid effects of concurrent method entrypoints update,
just pass the logger to the JIT compiler, which will invoke
it directly with the pointer to the newly allocated code.

Test: test.py --trace
Change-Id: I5fbcd7cbc948b7d46c98c1545d6e530fb1190602
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 890ba67..b76a0df 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -76,6 +76,7 @@
 #include "jit/debugger_interface.h"
 #include "jit/jit.h"
 #include "jit/jit_code_cache.h"
+#include "jit/jit_logger.h"
 #include "jni/quick/jni_compiler.h"
 #include "licm.h"
 #include "load_store_analysis.h"
@@ -334,7 +335,11 @@
     }
   }
 
-  bool JitCompile(Thread* self, jit::JitCodeCache* code_cache, ArtMethod* method, bool osr)
+  bool JitCompile(Thread* self,
+                  jit::JitCodeCache* code_cache,
+                  ArtMethod* method,
+                  bool osr,
+                  jit::JitLogger* jit_logger)
       OVERRIDE
       REQUIRES_SHARED(Locks::mutator_lock_);
 
@@ -1136,7 +1141,8 @@
 bool OptimizingCompiler::JitCompile(Thread* self,
                                     jit::JitCodeCache* code_cache,
                                     ArtMethod* method,
-                                    bool osr) {
+                                    bool osr,
+                                    jit::JitLogger* jit_logger) {
   StackHandleScope<3> hs(self);
   Handle<mirror::ClassLoader> class_loader(hs.NewHandle(
       method->GetDeclaringClass()->GetClassLoader()));
@@ -1272,6 +1278,9 @@
   }
 
   Runtime::Current()->GetJit()->AddMemoryUsage(method, arena.BytesUsed());
+  if (jit_logger != nullptr) {
+    jit_logger->WriteLog(code, code_allocator.GetSize(), method);
+  }
 
   return true;
 }