diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h index 3d195aa5be..23adba53ff 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.h +++ b/Userland/Libraries/LibJS/Bytecode/Op.h @@ -747,6 +747,9 @@ public: ThrowCompletionOr execute_impl(Bytecode::Interpreter&) const; DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const; + Register this_value() const { return m_this_value; } + IdentifierTableIndex property() const { return m_property; } + private: Register m_this_value; IdentifierTableIndex m_property; diff --git a/Userland/Libraries/LibJS/JIT/Compiler.cpp b/Userland/Libraries/LibJS/JIT/Compiler.cpp index e7607f4514..2b22d78c9b 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.cpp +++ b/Userland/Libraries/LibJS/JIT/Compiler.cpp @@ -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(&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); diff --git a/Userland/Libraries/LibJS/JIT/Compiler.h b/Userland/Libraries/LibJS/JIT/Compiler.h index e7f4cbab78..e6b30059e1 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.h +++ b/Userland/Libraries/LibJS/JIT/Compiler.h @@ -123,7 +123,8 @@ private: O(GetPrivateById, get_private_by_id) \ O(ResolveSuperBase, resolve_super_base) \ O(GetByIdWithThis, get_by_id_with_this) \ - O(GetByValueWithThis, get_by_value_with_this) + O(GetByValueWithThis, get_by_value_with_this) \ + O(DeleteByIdWithThis, delete_by_id_with_this) # define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \ void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);