Store inline caches in StackHandleScope<> in HInliner.

Avoid a managed heap allocation.

Test: m test-art-host-gtest
Test: testrunner.py --host
Bug: 181943478
Change-Id: I7ce65c93ad2f59490dbfa2aaccba98b6ca1fd585
diff --git a/compiler/optimizing/inliner.h b/compiler/optimizing/inliner.h
index 9503641..241c63b 100644
--- a/compiler/optimizing/inliner.h
+++ b/compiler/optimizing/inliner.h
@@ -19,6 +19,7 @@
 
 #include "dex/dex_file_types.h"
 #include "dex/invoke_type.h"
+#include "jit/profiling_info.h"
 #include "optimization.h"
 #include "profile/profile_compilation_info.h"
 
@@ -174,8 +175,7 @@
   // invoke info was found in the profile info.
   InlineCacheType GetInlineCacheJIT(
       HInvoke* invoke_instruction,
-      StackHandleScope<1>* hs,
-      /*out*/Handle<mirror::ObjectArray<mirror::Class>>* inline_cache)
+      /*out*/StackHandleScope<InlineCache::kIndividualCacheSize>* classes)
     REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Try getting the inline cache from AOT offline profile.
@@ -183,13 +183,12 @@
   // invoke info was found in the profile info.
   InlineCacheType GetInlineCacheAOT(
       HInvoke* invoke_instruction,
-      StackHandleScope<1>* hs,
-      /*out*/Handle<mirror::ObjectArray<mirror::Class>>* inline_cache)
+      /*out*/StackHandleScope<InlineCache::kIndividualCacheSize>* classes)
     REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Compute the inline cache type.
-  InlineCacheType GetInlineCacheType(
-      const Handle<mirror::ObjectArray<mirror::Class>>& classes)
+  static InlineCacheType GetInlineCacheType(
+      const StackHandleScope<InlineCache::kIndividualCacheSize>& classes)
     REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Try to inline the target of a monomorphic call. If successful, the code
@@ -197,16 +196,17 @@
   // if (receiver.getClass() != ic.GetMonomorphicType()) deopt
   // ... // inlined code
   bool TryInlineMonomorphicCall(HInvoke* invoke_instruction,
-                                Handle<mirror::ObjectArray<mirror::Class>> classes)
+                                const StackHandleScope<InlineCache::kIndividualCacheSize>& classes)
     REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Try to inline targets of a polymorphic call.
   bool TryInlinePolymorphicCall(HInvoke* invoke_instruction,
-                                Handle<mirror::ObjectArray<mirror::Class>> classes)
+                                const StackHandleScope<InlineCache::kIndividualCacheSize>& classes)
     REQUIRES_SHARED(Locks::mutator_lock_);
 
-  bool TryInlinePolymorphicCallToSameTarget(HInvoke* invoke_instruction,
-                                            Handle<mirror::ObjectArray<mirror::Class>> classes)
+  bool TryInlinePolymorphicCallToSameTarget(
+      HInvoke* invoke_instruction,
+      const StackHandleScope<InlineCache::kIndividualCacheSize>& classes)
     REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Returns whether or not we should use only polymorphic inlining with no deoptimizations.