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

LibJS/JIT: Add fast path for cached PutById

This commit is contained in:
Andreas Kling 2023-11-09 09:28:04 +01:00
parent b1b2ca1485
commit 55e467c359
7 changed files with 189 additions and 12 deletions

View file

@ -619,6 +619,23 @@ struct X86_64Assembler {
}
}
void shift_left(Operand dest, Optional<Operand> count)
{
VERIFY(dest.type == Operand::Type::Reg);
if (count.has_value()) {
VERIFY(count->type == Operand::Type::Imm);
VERIFY(count->fits_in_u8());
emit_rex_for_slash(dest, REX_W::Yes);
emit8(0xc1);
emit_modrm_slash(4, dest);
emit8(count->offset_or_immediate);
} else {
emit_rex_for_slash(dest, REX_W::Yes);
emit8(0xd3);
emit_modrm_slash(4, dest);
}
}
void shift_left32(Operand dest, Optional<Operand> count)
{
VERIFY(dest.type == Operand::Type::Reg);
@ -653,6 +670,23 @@ struct X86_64Assembler {
}
}
void arithmetic_right_shift(Operand dest, Optional<Operand> count)
{
VERIFY(dest.type == Operand::Type::Reg);
if (count.has_value()) {
VERIFY(count->type == Operand::Type::Imm);
VERIFY(count->fits_in_u8());
emit_rex_for_slash(dest, REX_W::Yes);
emit8(0xc1);
emit_modrm_slash(7, dest);
emit8(count->offset_or_immediate);
} else {
emit_rex_for_slash(dest, REX_W::Yes);
emit8(0xd3);
emit_modrm_slash(7, dest);
}
}
void arithmetic_right_shift32(Operand dest, Optional<Operand> count)
{
VERIFY(dest.type == Operand::Type::Reg);