1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

LibJS/JIT: Support the Return bytecode op

This commit is contained in:
Andreas Kling 2023-10-18 12:45:24 +02:00
parent 45be2a8f72
commit efe58ebf2f
2 changed files with 11 additions and 0 deletions

View file

@ -376,6 +376,13 @@ void Compiler::compile_div(Bytecode::Op::Div const& op)
check_exception();
}
void Compiler::compile_return(Bytecode::Op::Return const&)
{
load_vm_register(GPR0, Bytecode::Register::accumulator());
store_vm_register(Bytecode::Register::return_value(), GPR0);
m_assembler.exit();
}
OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable const& bytecode_executable)
{
if (getenv("LIBJS_NO_JIT"))
@ -449,6 +456,9 @@ OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable const& bytecode_
case Bytecode::Instruction::Type::Div:
compiler.compile_div(static_cast<Bytecode::Op::Div const&>(op));
break;
case Bytecode::Instruction::Type::Return:
compiler.compile_return(static_cast<Bytecode::Op::Return const&>(op));
break;
default:
dbgln("JIT compilation failed: {}", bytecode_executable.name);
dbgln("Unsupported bytecode op: {}", op.to_deprecated_string(bytecode_executable));