1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:27:45 +00:00

LibJS/JIT: Compile the ImportCall instruction

This commit is contained in:
Simon Wanner 2023-10-29 23:41:33 +01:00 committed by Andreas Kling
parent 246daa0810
commit c0c40110c1
3 changed files with 19 additions and 1 deletions

View file

@ -338,6 +338,9 @@ public:
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
Register specifier() const { return m_specifier; }
Register options() const { return m_options; }
private:
Register m_specifier;
Register m_options;

View file

@ -1527,6 +1527,20 @@ void Compiler::compile_put_private_by_id(Bytecode::Op::PutPrivateById const& op)
check_exception();
}
static Value cxx_import_call(VM& vm, Value specifier, Value options)
{
return TRY_OR_SET_EXCEPTION(perform_import_call(vm, specifier, options));
}
void Compiler::compile_import_call(Bytecode::Op::ImportCall const& op)
{
load_vm_register(ARG1, op.specifier());
load_vm_register(ARG2, op.options());
native_call((void*)cxx_import_call);
store_vm_register(Bytecode::Register::accumulator(), RET);
check_exception();
}
void Compiler::jump_to_exit()
{
m_assembler.jump(m_exit_label);

View file

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