diff options
author | Calin Juravle <calin@google.com> | 2015-04-23 17:19:34 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-23 17:19:34 +0000 |
commit | 322b389a74177c9d938f1f73d53110623dfc61b6 (patch) | |
tree | b2437d4cdce399ce462d587d9c9c47a8fceb8953 /compiler/optimizing/code_generator_arm64.cc | |
parent | 272bf7e60add5f741fb9a2589eaa71945257afcc (diff) | |
parent | af88835231c2508509eb19aa2d21b92879351962 (diff) | |
download | art-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.cc | 14 |
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())); |