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

LibJS/JIT: Compile the DeleteByValue instruction

This commit is contained in:
Jakub Berkop 2023-10-29 21:20:25 +01:00 committed by Andreas Kling
parent f5fcd4596c
commit 0776404e03
6 changed files with 33 additions and 10 deletions

View file

@ -1352,6 +1352,20 @@ void Compiler::compile_delete_by_id(Bytecode::Op::DeleteById const& op)
check_exception();
}
static Value cxx_delete_by_value(VM& vm, Value base_value, Value property_key_value)
{
return TRY_OR_SET_EXCEPTION(Bytecode::delete_by_value(vm.bytecode_interpreter(), base_value, property_key_value));
}
void Compiler::compile_delete_by_value(Bytecode::Op::DeleteByValue const& op)
{
load_vm_register(ARG1, op.base());
load_vm_register(ARG2, Bytecode::Register::accumulator());
native_call((void*)cxx_delete_by_value);
store_vm_register(Bytecode::Register::accumulator(), RET);
check_exception();
}
void Compiler::jump_to_exit()
{
m_assembler.jump(m_exit_label);

View file

@ -115,7 +115,8 @@ private:
O(IteratorClose, iterator_close) \
O(IteratorToArray, iterator_to_array) \
O(Append, append) \
O(DeleteById, delete_by_id)
O(DeleteById, delete_by_id) \
O(DeleteByValue, delete_by_value)
# define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \
void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);