1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

LibJS/JIT: Compile the JumpUndefined instruction

This commit is contained in:
Simon Wanner 2023-10-30 00:39:58 +01:00 committed by Andreas Kling
parent a16082c6a5
commit fd059d4e4a
2 changed files with 18 additions and 0 deletions

View file

@ -212,6 +212,23 @@ void Compiler::compile_jump_nullish(Bytecode::Op::JumpNullish const& op)
m_assembler.jump(label_for(op.false_target()->block()));
}
void Compiler::compile_jump_undefined(Bytecode::Op::JumpUndefined const& op)
{
load_vm_register(GPR0, Bytecode::Register::accumulator());
m_assembler.shift_right(
Assembler::Operand::Register(GPR0),
Assembler::Operand::Imm(48));
m_assembler.jump_if(
Assembler::Operand::Register(GPR0),
Assembler::Condition::EqualTo,
Assembler::Operand::Imm(UNDEFINED_TAG),
label_for(op.true_target()->block()));
m_assembler.jump(label_for(op.false_target()->block()));
}
[[maybe_unused]] static Value cxx_increment(VM& vm, Value value)
{
auto old_value = TRY_OR_SET_EXCEPTION(value.to_numeric(vm));