mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:28:11 +00:00
LibJS/JIT: Compile the DeleteVariable instruction
This commit is contained in:
parent
cd18bc9d55
commit
06ea4cfc4f
2 changed files with 18 additions and 1 deletions
|
@ -1552,6 +1552,22 @@ void Compiler::compile_get_import_meta(Bytecode::Op::GetImportMeta const&)
|
|||
store_vm_register(Bytecode::Register::accumulator(), RET);
|
||||
}
|
||||
|
||||
static Value cxx_delete_variable(VM& vm, DeprecatedFlyString const& identifier)
|
||||
{
|
||||
auto reference = TRY_OR_SET_EXCEPTION(vm.resolve_binding(identifier));
|
||||
return Value(TRY_OR_SET_EXCEPTION(reference.delete_(vm)));
|
||||
}
|
||||
|
||||
void Compiler::compile_delete_variable(Bytecode::Op::DeleteVariable const& op)
|
||||
{
|
||||
m_assembler.mov(
|
||||
Assembler::Operand::Register(ARG1),
|
||||
Assembler::Operand::Imm(bit_cast<u64>(&m_bytecode_executable.get_identifier(op.identifier().value()))));
|
||||
native_call((void*)cxx_delete_variable);
|
||||
store_vm_register(Bytecode::Register::accumulator(), RET);
|
||||
check_exception();
|
||||
}
|
||||
|
||||
void Compiler::jump_to_exit()
|
||||
{
|
||||
m_assembler.jump(m_exit_label);
|
||||
|
|
|
@ -128,7 +128,8 @@ private:
|
|||
O(PutByIdWithThis, put_by_id_with_this) \
|
||||
O(PutPrivateById, put_private_by_id) \
|
||||
O(ImportCall, import_call) \
|
||||
O(GetImportMeta, get_import_meta)
|
||||
O(GetImportMeta, get_import_meta) \
|
||||
O(DeleteVariable, delete_variable)
|
||||
|
||||
# define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \
|
||||
void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue