Fix compiler crash due to inline caches and improve docs

Fix a potential crash when extracting the inline caches from the method.
The way we copied the inline cache into a new map was not correct. In
ProfileCompilationInfo::GetMethod() we reused the same profile arena
for allocation which is not thread safe. When compiling with multiple
threads the profile arena could become corrupted due to races.

Address all the comments from the late reviews on the CL which migrates
the profiles to arena storage.

Test: m test-art-host
      compile with speed-profile apps on device
Bug: 37711886
Bug: 62062532
Change-Id: I61af5175bc68b2c7dba77afb3cdff221989cc387
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 8f5c51f..3e6b845 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -578,7 +578,6 @@
     return kInlineCacheNoData;
   }
 
-  // Use the profile arena when extracting the method info.
   std::unique_ptr<ProfileCompilationInfo::OfflineProfileMethodInfo> offline_profile =
       pci->GetMethod(caller_dex_file.GetLocation(),
                      caller_dex_file.GetLocationChecksum(),
@@ -603,8 +602,8 @@
     const ProfileCompilationInfo::OfflineProfileMethodInfo& offline_profile,
     /*out*/Handle<mirror::ObjectArray<mirror::Class>> inline_cache)
     REQUIRES_SHARED(Locks::mutator_lock_) {
-  const auto it = offline_profile.inline_caches.find(invoke_instruction->GetDexPc());
-  if (it == offline_profile.inline_caches.end()) {
+  const auto it = offline_profile.inline_caches->find(invoke_instruction->GetDexPc());
+  if (it == offline_profile.inline_caches->end()) {
     return kInlineCacheUninitialized;
   }