mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:17:34 +00:00
LibJS/JIT: Add Assembler::jump(Operand) and verify_not_reached()
Yet another jump() overload, and also a way to crash if we end up somewhere we shouldn't be while in jitted code.
This commit is contained in:
parent
e3560c2545
commit
9d35016284
1 changed files with 19 additions and 0 deletions
|
@ -204,6 +204,25 @@ struct Assembler {
|
|||
return make_label();
|
||||
}
|
||||
|
||||
void jump(Operand op)
|
||||
{
|
||||
if (op.type == Operand::Type::Reg) {
|
||||
if (to_underlying(op.reg) >= 8)
|
||||
emit8(0x41);
|
||||
emit8(0xff);
|
||||
emit8(0xe0 | encode_reg(op.reg));
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void verify_not_reached()
|
||||
{
|
||||
// ud2
|
||||
emit8(0x0f);
|
||||
emit8(0x0b);
|
||||
}
|
||||
|
||||
void jump(Bytecode::BasicBlock& target)
|
||||
{
|
||||
// jmp target (RIP-relative 32-bit offset)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue