[arm64] Use CBZ in binary switch.
When comparing with zero, we can generate a CBZ instruction instead of a CMP+B. If we teach TurboAssembler::JumpIfEqual() to do it then we can do it in code generated for binary switches. Change-Id: I39a045ed666fd6569bf9c9f6be28c4efbeeb01a9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1836254 Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Commit-Queue: Pierre Langlois <pierre.langlois@arm.com> Cr-Commit-Position: refs/heads/master@{#64094}
This commit is contained in:
parent
e92e9151e9
commit
3556d2504c
@ -1055,13 +1055,11 @@ void TurboAssembler::JumpIfSmi(Register value, Label* smi_label,
|
||||
}
|
||||
|
||||
void TurboAssembler::JumpIfEqual(Register x, int32_t y, Label* dest) {
|
||||
Cmp(x, y);
|
||||
B(eq, dest);
|
||||
CompareAndBranch(x, y, eq, dest);
|
||||
}
|
||||
|
||||
void TurboAssembler::JumpIfLessThan(Register x, int32_t y, Label* dest) {
|
||||
Cmp(x, y);
|
||||
B(lt, dest);
|
||||
CompareAndBranch(x, y, lt, dest);
|
||||
}
|
||||
|
||||
void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label) {
|
||||
@ -1201,7 +1199,7 @@ void TurboAssembler::DropSlots(int64_t count) {
|
||||
|
||||
void TurboAssembler::PushArgument(const Register& arg) { Push(padreg, arg); }
|
||||
|
||||
void MacroAssembler::CompareAndBranch(const Register& lhs, const Operand& rhs,
|
||||
void TurboAssembler::CompareAndBranch(const Register& lhs, const Operand& rhs,
|
||||
Condition cond, Label* label) {
|
||||
if (rhs.IsImmediate() && (rhs.ImmediateValue() == 0) &&
|
||||
((cond == eq) || (cond == ne))) {
|
||||
@ -1216,7 +1214,7 @@ void MacroAssembler::CompareAndBranch(const Register& lhs, const Operand& rhs,
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::CompareTaggedAndBranch(const Register& lhs,
|
||||
void TurboAssembler::CompareTaggedAndBranch(const Register& lhs,
|
||||
const Operand& rhs, Condition cond,
|
||||
Label* label) {
|
||||
if (COMPRESS_POINTERS_BOOL) {
|
||||
|
@ -844,6 +844,13 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
||||
void CheckPageFlag(const Register& object, int mask, Condition cc,
|
||||
Label* condition_met);
|
||||
|
||||
// Compare a register with an operand, and branch to label depending on the
|
||||
// condition. May corrupt the status flags.
|
||||
inline void CompareAndBranch(const Register& lhs, const Operand& rhs,
|
||||
Condition cond, Label* label);
|
||||
inline void CompareTaggedAndBranch(const Register& lhs, const Operand& rhs,
|
||||
Condition cond, Label* label);
|
||||
|
||||
// Test the bits of register defined by bit_pattern, and branch if ANY of
|
||||
// those bits are set. May corrupt the status flags.
|
||||
inline void TestAndBranchIfAnySet(const Register& reg,
|
||||
@ -1644,13 +1651,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
|
||||
// be aligned to 16 bytes.
|
||||
void PeekPair(const CPURegister& dst1, const CPURegister& dst2, int offset);
|
||||
|
||||
// Compare a register with an operand, and branch to label depending on the
|
||||
// condition. May corrupt the status flags.
|
||||
inline void CompareAndBranch(const Register& lhs, const Operand& rhs,
|
||||
Condition cond, Label* label);
|
||||
inline void CompareTaggedAndBranch(const Register& lhs, const Operand& rhs,
|
||||
Condition cond, Label* label);
|
||||
|
||||
// Insert one or more instructions into the instruction stream that encode
|
||||
// some caller-defined data. The instructions used will be executable with no
|
||||
// side effects.
|
||||
|
Loading…
Reference in New Issue
Block a user