1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +00:00

LibJS/JIT: Compile the DeleteByIdWithThis instruction

This commit is contained in:
Simon Wanner 2023-10-29 22:05:09 +01:00 committed by Andreas Kling
parent b53277110e
commit 38d5d7979b
3 changed files with 22 additions and 1 deletions

View file

@ -1469,6 +1469,23 @@ void Compiler::compile_get_by_value_with_this(Bytecode::Op::GetByValueWithThis c
check_exception();
}
static Value cxx_delete_by_id_with_this(VM& vm, Value base_value, DeprecatedFlyString const& identifier, Value this_value)
{
auto reference = Reference { base_value, identifier, this_value, vm.in_strict_mode() };
return Value(TRY_OR_SET_EXCEPTION(reference.delete_(vm)));
}
void Compiler::compile_delete_by_id_with_this(Bytecode::Op::DeleteByIdWithThis const& op)
{
load_vm_register(ARG1, Bytecode::Register::accumulator());
m_assembler.mov(
Assembler::Operand::Register(ARG2),
Assembler::Operand::Imm(bit_cast<u64>(&m_bytecode_executable.get_identifier(op.property()))));
load_vm_register(ARG3, op.this_value());
native_call((void*)cxx_delete_by_id_with_this);
store_vm_register(Bytecode::Register::accumulator(), RET);
}
void Compiler::jump_to_exit()
{
m_assembler.jump(m_exit_label);