summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2017-04-26 15:27:13 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-04-26 15:27:15 +0000
commit02b1976a9d25fb3649f734962f1127786cf9dc81 (patch)
treed2889650a4d04495fa230384fd7dad66e46d52f3 /compiler/optimizing/nodes.h
parentd21711eae1224c18690d1a460b5b986fb4885654 (diff)
parent66d691de219e840b3f84385d8bd1b7001562b0e5 (diff)
Merge "ARM64: Link-time generated thunks for ArrayGet Baker CC read barrier."
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 8368026e92..36c7df70ce 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -5377,10 +5377,16 @@ class HArrayGet FINAL : public HExpression<2> {
}
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;
}