1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:37:35 +00:00

LibJS/JIT: Compile the ResolveThisBinding bytecode instruction

This commit is contained in:
Andreas Kling 2023-10-20 12:33:08 +02:00
parent b2602a4bae
commit 1c0efbec6b
2 changed files with 16 additions and 0 deletions

View file

@ -399,6 +399,18 @@ void Compiler::compile_to_numeric(Bytecode::Op::ToNumeric const&)
check_exception();
}
static Value cxx_resolve_this_binding(VM& vm)
{
return TRY_OR_SET_EXCEPTION(vm.resolve_this_binding());
}
void Compiler::compile_resolve_this_binding(Bytecode::Op::ResolveThisBinding const&)
{
m_assembler.native_call((void*)cxx_resolve_this_binding);
store_vm_register(Bytecode::Register::accumulator(), RET);
check_exception();
}
OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_executable)
{
if (getenv("LIBJS_NO_JIT"))
@ -469,6 +481,9 @@ OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_execut
case Bytecode::Instruction::Type::ToNumeric:
compiler.compile_to_numeric(static_cast<Bytecode::Op::ToNumeric const&>(op));
break;
case Bytecode::Instruction::Type::ResolveThisBinding:
compiler.compile_resolve_this_binding(static_cast<Bytecode::Op::ResolveThisBinding const&>(op));
break;
#define DO_COMPILE_COMMON_BINARY_OP(TitleCaseName, snake_case_name) \
case Bytecode::Instruction::Type::TitleCaseName: \

View file

@ -42,6 +42,7 @@ private:
void compile_leave_unwind_context(Bytecode::Op::LeaveUnwindContext const&);
void compile_throw(Bytecode::Op::Throw const&);
void compile_to_numeric(Bytecode::Op::ToNumeric const&);
void compile_resolve_this_binding(Bytecode::Op::ResolveThisBinding const&);
#define DO_COMPILE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);