diff options
| -rw-r--r-- | compiler/optimizing/code_generator_arm.cc | 16 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_arm64.cc | 13 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 4 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_x86_64.cc | 4 |
4 files changed, 13 insertions, 24 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; } } diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 35b16051e5..a085fea0f8 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -3782,26 +3782,23 @@ void InstructionCodeGeneratorARM64::VisitCheckCast(HCheckCast* instruction) { iftable_offset, maybe_temp2_loc, kWithoutReadBarrier); - vixl::aarch64::Label is_null; // Null iftable means it is empty and will always fail the check. - __ Cbz(temp, &is_null); + __ Cbz(temp, type_check_slow_path->GetEntryLabel()); // Loop through the iftable and check if any class matches. __ Ldr(WRegisterFrom(maybe_temp2_loc), HeapOperand(temp.W(), array_length_offset)); vixl::aarch64::Label start_loop; __ Bind(&start_loop); + __ Cbz(WRegisterFrom(maybe_temp2_loc), type_check_slow_path->GetEntryLabel()); __ Ldr(WRegisterFrom(maybe_temp3_loc), HeapOperand(temp.W(), object_array_data_offset)); GetAssembler()->MaybeUnpoisonHeapReference(WRegisterFrom(maybe_temp3_loc)); - __ Cmp(cls, WRegisterFrom(maybe_temp3_loc)); - __ B(eq, &done); // Return if same class. // Go to next interface. __ Add(temp, temp, 2 * kHeapReferenceSize); __ Sub(WRegisterFrom(maybe_temp2_loc), WRegisterFrom(maybe_temp2_loc), 2); - __ Cbnz(WRegisterFrom(maybe_temp2_loc), &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, WRegisterFrom(maybe_temp3_loc)); + __ B(ne, &start_loop); break; } } diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 2a9e21d1e1..45edff8767 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -6833,10 +6833,9 @@ void InstructionCodeGeneratorX86::VisitCheckCast(HCheckCast* instruction) { temp_loc, iftable_offset, kWithoutReadBarrier); - NearLabel is_null; // Null iftable means it is empty. __ testl(temp, temp); - __ j(kZero, &is_null); + __ j(kZero, type_check_slow_path->GetEntryLabel()); // Loop through the iftable and check if any class matches. __ movl(maybe_temp2_loc.AsRegister<Register>(), Address(temp, array_length_offset)); @@ -6849,7 +6848,6 @@ void InstructionCodeGeneratorX86::VisitCheckCast(HCheckCast* instruction) { __ addl(temp, Immediate(2 * kHeapReferenceSize)); __ subl(maybe_temp2_loc.AsRegister<Register>(), Immediate(2)); __ j(kNotZero, &start_loop); - __ Bind(&is_null); } __ jmp(type_check_slow_path->GetEntryLabel()); diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index cb89e50dbb..f7a2f40f33 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -6243,10 +6243,9 @@ void InstructionCodeGeneratorX86_64::VisitCheckCast(HCheckCast* instruction) { temp_loc, iftable_offset, kWithoutReadBarrier); - NearLabel is_null; // Null iftable means it is empty. __ testl(temp, temp); - __ j(kZero, &is_null); + __ j(kZero, type_check_slow_path->GetEntryLabel()); // Loop through the iftable and check if any class matches. __ movl(maybe_temp2_loc.AsRegister<CpuRegister>(), Address(temp, array_length_offset)); @@ -6259,7 +6258,6 @@ void InstructionCodeGeneratorX86_64::VisitCheckCast(HCheckCast* instruction) { __ addl(temp, Immediate(2 * kHeapReferenceSize)); __ subl(maybe_temp2_loc.AsRegister<CpuRegister>(), Immediate(2)); __ j(kNotZero, &start_loop); - __ Bind(&is_null); } __ jmp(type_check_slow_path->GetEntryLabel()); break; |