ARM64: Link-time generated thunks for ArrayGet Baker CC read barrier.

Test: Added a test to relative_patcher_arm64
Test: m test-art-target-gtest on Nexus 6P.
Test: Nexus 6P boots.
Test: testrunner.py --target on Nexus 6P.
Test: Nexus 6P boots with heap poisoning.
Test: testrunner.py --target on Nexus 6P with heap poisoning.
Bug: 29516974
Bug: 30126666
Bug: 36141117
Change-Id: Id0f23089c55cbb53b84305c11bb4b03718561ade
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 6be237e..f9eb343 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -5376,10 +5376,16 @@
   }
   bool CanDoImplicitNullCheckOn(HInstruction* obj ATTRIBUTE_UNUSED) const OVERRIDE {
     // TODO: We can be smarter here.
-    // Currently, the array access is always preceded by an ArrayLength or a NullCheck
-    // which generates the implicit null check. There are cases when these can be removed
-    // to produce better code. If we ever add optimizations to do so we should allow an
-    // implicit check here (as long as the address falls in the first page).
+    // Currently, unless the array is the result of NewArray, the array access is always
+    // preceded by some form of null NullCheck necessary for the bounds check, usually
+    // implicit null check on the ArrayLength input to BoundsCheck or Deoptimize for
+    // dynamic BCE. There are cases when these could be removed to produce better code.
+    // If we ever add optimizations to do so we should allow an implicit check here
+    // (as long as the address falls in the first page).
+    //
+    // As an example of such fancy optimization, we could eliminate BoundsCheck for
+    //     a = cond ? new int[1] : null;
+    //     a[0];  // The Phi does not need bounds check for either input.
     return false;
   }