Fix a libartd.so boot crash in Heap::AllocObjectWithAllocator()

Bug: 11806947
Change-Id: I826875f23ee2233d4128e852ff6fe7e26ced378f
diff --git a/runtime/entrypoints/portable/portable_alloc_entrypoints.cc b/runtime/entrypoints/portable/portable_alloc_entrypoints.cc
index 6d23efe..0d57516 100644
--- a/runtime/entrypoints/portable/portable_alloc_entrypoints.cc
+++ b/runtime/entrypoints/portable/portable_alloc_entrypoints.cc
@@ -57,8 +57,8 @@
                                                                         uint32_t length,
                                                                         Thread* thread)
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-  return CheckAndAllocArrayFromCode(type_idx, referrer, length, thread, false,
-                                    gc::kAllocatorTypeFreeList);
+  return CheckAndAllocArrayFromCodeInstrumented(type_idx, referrer, length, thread, false,
+                                                gc::kAllocatorTypeFreeList);
 }
 
 extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code_with_access_check(uint32_t type_idx,
@@ -66,8 +66,8 @@
                                                                                           uint32_t length,
                                                                                           Thread* thread)
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-  return CheckAndAllocArrayFromCode(type_idx, referrer, length, thread, true,
-                                    gc::kAllocatorTypeFreeList);
+  return CheckAndAllocArrayFromCodeInstrumented(type_idx, referrer, length, thread, true,
+                                                gc::kAllocatorTypeFreeList);
 }
 
 }  // namespace art
diff --git a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
index b71b880..9155088 100644
--- a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
@@ -57,14 +57,22 @@
     mirror::ArtMethod** sp) \
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \
   FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); \
-  return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, false, allocator_type); \
+  if (!instrumented_bool) { \
+    return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, false, allocator_type); \
+  } else { \
+    return CheckAndAllocArrayFromCodeInstrumented(type_idx, method, component_count, self, false, allocator_type); \
+  } \
 } \
 extern "C" mirror::Array* artCheckAndAllocArrayFromCodeWithAccessCheck##suffix##suffix2( \
     uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self, \
     mirror::ArtMethod** sp) \
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \
   FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); \
-  return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, true, allocator_type); \
+  if (!instrumented_bool) { \
+    return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, true, allocator_type); \
+  } else { \
+    return CheckAndAllocArrayFromCodeInstrumented(type_idx, method, component_count, self, true, allocator_type); \
+  } \
 }
 
 #define GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(suffix, allocator_type) \