diff options
author | Mathieu Chartier <mathieuc@google.com> | 2016-11-14 10:50:29 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2016-11-14 11:35:27 -0800 |
commit | afbcdafde4d2c1de293c3ba1da22f579df200b3b (patch) | |
tree | 6d75c7f26b7b358e0e8ca869ae6d206f7bf0294a /compiler/optimizing/code_generator_arm.cc | |
parent | 81cae78d1853893ff9c3ecea4b5100002a538eb7 (diff) |
Clean up interface check cast
Changed arm, arm64 to use less labels and removed forward branch
in the success case.
Cleaned up X86, X86_64 to remove the is_null label.
Bug: 12687968
Bug: 32577579
Test: test-art-host, test-art-target CC
Change-Id: Iba426dff548b2ef42198fad13efeb075f7c724a7
Diffstat (limited to 'compiler/optimizing/code_generator_arm.cc')
-rw-r--r-- | compiler/optimizing/code_generator_arm.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 7c72d00389..046c2d8b87 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -6470,30 +6470,26 @@ void InstructionCodeGeneratorARM::VisitCheckCast(HCheckCast* instruction) { iftable_offset, maybe_temp2_loc, kWithoutReadBarrier); - Label is_null; // Null iftable means it is empty and will always fail the check. - // Not cbz since the temp may not be a low register. - __ CompareAndBranchIfZero(temp, &is_null); + __ CompareAndBranchIfZero(temp, type_check_slow_path->GetEntryLabel()); // Loop through the iftable and check if any class matches. __ ldr(maybe_temp2_loc.AsRegister<Register>(), Address(temp, array_length_offset)); Label start_loop; __ Bind(&start_loop); + __ CompareAndBranchIfZero(maybe_temp2_loc.AsRegister<Register>(), + type_check_slow_path->GetEntryLabel()); __ ldr(maybe_temp3_loc.AsRegister<Register>(), Address(temp, object_array_data_offset)); __ MaybeUnpoisonHeapReference(maybe_temp3_loc.AsRegister<Register>()); - __ cmp(cls, ShifterOperand(maybe_temp3_loc.AsRegister<Register>())); - __ b(&done, EQ); // Return if same class. // Go to next interface. __ add(temp, temp, ShifterOperand(2 * kHeapReferenceSize)); __ sub(maybe_temp2_loc.AsRegister<Register>(), maybe_temp2_loc.AsRegister<Register>(), ShifterOperand(2)); - // Not cbnz since the temp may not be a low register. - __ CompareAndBranchIfNonZero(maybe_temp2_loc.AsRegister<Register>(), &start_loop); - __ Bind(&is_null); - - __ b(type_check_slow_path->GetEntryLabel()); + // Compare the classes and continue the loop if they do not match. + __ cmp(cls, ShifterOperand(maybe_temp3_loc.AsRegister<Register>())); + __ b(&start_loop, NE); break; } } |