From 712c89dacf61c1928c080045ef10983780d9e8c6 Mon Sep 17 00:00:00 2001 From: Simon Wanner Date: Mon, 30 Oct 2023 00:16:42 +0100 Subject: [PATCH] LibJS/JIT: Compile the GetNewTarget instruction --- Userland/Libraries/LibJS/JIT/Compiler.cpp | 11 +++++++++++ Userland/Libraries/LibJS/JIT/Compiler.h | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/JIT/Compiler.cpp b/Userland/Libraries/LibJS/JIT/Compiler.cpp index 66599560de..3bcb184850 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.cpp +++ b/Userland/Libraries/LibJS/JIT/Compiler.cpp @@ -1585,6 +1585,17 @@ void Compiler::compile_get_method(Bytecode::Op::GetMethod const& op) check_exception(); } +static Value cxx_get_new_target(VM& vm) +{ + return vm.get_new_target(); +} + +void Compiler::compile_get_new_target(Bytecode::Op::GetNewTarget const&) +{ + native_call((void*)cxx_get_new_target); + 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 c2ccb206e6..852662714f 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.h +++ b/Userland/Libraries/LibJS/JIT/Compiler.h @@ -130,7 +130,8 @@ private: O(ImportCall, import_call) \ O(GetImportMeta, get_import_meta) \ O(DeleteVariable, delete_variable) \ - O(GetMethod, get_method) + O(GetMethod, get_method) \ + O(GetNewTarget, get_new_target) # define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \ void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);