Ver código fonte

LibJS/JIT: Compile the GetNewTarget instruction

Simon Wanner 1 ano atrás
pai
commit
712c89dacf

+ 11 - 0
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);

+ 2 - 1
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&);