mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:27:43 +00:00
LibJIT/LibJS: Remove jump_if_***()
in favor of jump_if()
The `jump_if()` function implements all the conditions already in use and more, so let's avoid encouraging more wrapper functions.
This commit is contained in:
parent
288aff01cd
commit
56e8f52cb3
2 changed files with 48 additions and 55 deletions
|
@ -358,40 +358,6 @@ struct Assembler {
|
|||
label.add_jump(*this, m_output.size());
|
||||
}
|
||||
|
||||
void jump_if_zero(Operand reg, Label& label)
|
||||
{
|
||||
jump_if(reg, Condition::EqualTo, Operand::Imm(0), label);
|
||||
}
|
||||
|
||||
void jump_if_not_zero(Operand reg, Label& label)
|
||||
{
|
||||
jump_if(reg, Condition::NotEqualTo, Operand::Imm(0), label);
|
||||
}
|
||||
|
||||
void jump_if_equal(Operand lhs, Operand rhs, Label& label)
|
||||
{
|
||||
jump_if(lhs, Condition::EqualTo, rhs, label);
|
||||
}
|
||||
|
||||
void jump_if_not_equal(Operand lhs, Operand rhs, Label& label)
|
||||
{
|
||||
jump_if(lhs, Condition::NotEqualTo, rhs, label);
|
||||
}
|
||||
|
||||
void jump_if_less_than(Operand lhs, Operand rhs, Label& label)
|
||||
{
|
||||
jump_if(lhs, Condition::SignedLessThan, rhs, label);
|
||||
}
|
||||
|
||||
void jump_if_overflow(Label& label)
|
||||
{
|
||||
// jo label (RIP-relative 32-bit offset)
|
||||
emit8(0x0f);
|
||||
emit8(0x80);
|
||||
emit32(0xdeadbeef);
|
||||
label.add_jump(*this, m_output.size());
|
||||
}
|
||||
|
||||
void sign_extend_32_to_64_bits(Reg reg)
|
||||
{
|
||||
// movsxd (reg as 64-bit), (reg as 32-bit)
|
||||
|
@ -545,7 +511,7 @@ struct Assembler {
|
|||
}
|
||||
}
|
||||
|
||||
void add32(Operand dst, Operand src)
|
||||
void add32(Operand dst, Operand src, Optional<Label&> label)
|
||||
{
|
||||
if (dst.type == Operand::Type::Reg && to_underlying(dst.reg) < 8 && src.type == Operand::Type::Reg && to_underlying(src.reg) < 8) {
|
||||
emit8(0x01);
|
||||
|
@ -561,6 +527,14 @@ struct Assembler {
|
|||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (label.has_value()) {
|
||||
// jo label (RIP-relative 32-bit offset)
|
||||
emit8(0x0f);
|
||||
emit8(0x80);
|
||||
emit32(0xdeadbeef);
|
||||
label->add_jump(*this, m_output.size());
|
||||
}
|
||||
}
|
||||
|
||||
void sub(Operand dst, Operand src)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue