Browse Source

LibJS/JIT: Compile the GetImportMeta instruction

Simon Wanner 1 year ago
parent
commit
cd18bc9d55
2 changed files with 13 additions and 1 deletions
  1. 11 0
      Userland/Libraries/LibJS/JIT/Compiler.cpp
  2. 2 1
      Userland/Libraries/LibJS/JIT/Compiler.h

+ 11 - 0
Userland/Libraries/LibJS/JIT/Compiler.cpp

@@ -1541,6 +1541,17 @@ void Compiler::compile_import_call(Bytecode::Op::ImportCall const& op)
     check_exception();
 }
 
+static Value cxx_get_import_meta(VM& vm)
+{
+    return vm.get_import_meta();
+}
+
+void Compiler::compile_get_import_meta(Bytecode::Op::GetImportMeta const&)
+{
+    native_call((void*)cxx_get_import_meta);
+    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

@@ -127,7 +127,8 @@ private:
         O(DeleteByIdWithThis, delete_by_id_with_this)                            \
         O(PutByIdWithThis, put_by_id_with_this)                                  \
         O(PutPrivateById, put_private_by_id)                                     \
-        O(ImportCall, import_call)
+        O(ImportCall, import_call)                                               \
+        O(GetImportMeta, get_import_meta)
 
 #    define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \
         void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);