1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:57:44 +00:00

LibJS/JIT: Add fast path for decrement

Generate jitted code for the decrement opcode.
This commit is contained in:
Stephan Vedder 2023-11-07 16:56:14 +01:00 committed by Andreas Kling
parent 0e69f744df
commit 13726fd3b7
2 changed files with 47 additions and 0 deletions

View file

@ -757,6 +757,21 @@ struct X86_64Assembler {
}
}
void dec32(Operand op, Optional<Label&> overflow_label)
{
if (op.is_register_or_memory()) {
emit_rex_for_slash(op, REX_W::No);
emit8(0xff);
emit_modrm_slash(1, op);
} else {
VERIFY_NOT_REACHED();
}
if (overflow_label.has_value()) {
jump_if(Condition::Overflow, *overflow_label);
}
}
void add(Operand dst, Operand src)
{
if (dst.is_register_or_memory() && src.type == Operand::Type::Reg) {