summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/code_generator_arm64.cc
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2015-04-23 17:19:34 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-23 17:19:34 +0000
commit322b389a74177c9d938f1f73d53110623dfc61b6 (patch)
treeb2437d4cdce399ce462d587d9c9c47a8fceb8953 /compiler/optimizing/code_generator_arm64.cc
parent272bf7e60add5f741fb9a2589eaa71945257afcc (diff)
parentaf88835231c2508509eb19aa2d21b92879351962 (diff)
downloadart-322b389a74177c9d938f1f73d53110623dfc61b6.zip
art-322b389a74177c9d938f1f73d53110623dfc61b6.tar.gz
art-322b389a74177c9d938f1f73d53110623dfc61b6.tar.bz2
Merge "Remove unnecessary null checks in CheckCast and InstanceOf"
Diffstat (limited to 'compiler/optimizing/code_generator_arm64.cc')
-rw-r--r--compiler/optimizing/code_generator_arm64.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc
index 23ba339..1c6debd 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -1452,8 +1452,10 @@ void InstructionCodeGeneratorARM64::VisitCheckCast(HCheckCast* instruction) {
instruction, locations->InAt(1), LocationFrom(obj_cls), instruction->GetDexPc());
codegen_->AddSlowPath(slow_path);
- // TODO: avoid this check if we know obj is not null.
- __ Cbz(obj, slow_path->GetExitLabel());
+ // Avoid null check if we know obj is not null.
+ if (instruction->MustDoNullCheck()) {
+ __ Cbz(obj, slow_path->GetExitLabel());
+ }
// Compare the class of `obj` with `cls`.
__ Ldr(obj_cls, HeapOperand(obj, mirror::Object::ClassOffset()));
__ Cmp(obj_cls, cls);
@@ -1855,9 +1857,11 @@ void InstructionCodeGeneratorARM64::VisitInstanceOf(HInstanceOf* instruction) {
vixl::Label done;
// Return 0 if `obj` is null.
- // TODO: Avoid this check if we know `obj` is not null.
- __ Mov(out, 0);
- __ Cbz(obj, &done);
+ // Avoid null check if we know `obj` is not null.
+ if (instruction->MustDoNullCheck()) {
+ __ Mov(out, 0);
+ __ Cbz(obj, &done);
+ }
// Compare the class of `obj` with `cls`.
__ Ldr(out, HeapOperand(obj, mirror::Object::ClassOffset()));