mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibJS/JIT: Support the Return bytecode op
This commit is contained in:
parent
45be2a8f72
commit
efe58ebf2f
2 changed files with 11 additions and 0 deletions
|
@ -376,6 +376,13 @@ void Compiler::compile_div(Bytecode::Op::Div const& op)
|
||||||
check_exception();
|
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)
|
OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable const& bytecode_executable)
|
||||||
{
|
{
|
||||||
if (getenv("LIBJS_NO_JIT"))
|
if (getenv("LIBJS_NO_JIT"))
|
||||||
|
@ -449,6 +456,9 @@ OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable const& bytecode_
|
||||||
case Bytecode::Instruction::Type::Div:
|
case Bytecode::Instruction::Type::Div:
|
||||||
compiler.compile_div(static_cast<Bytecode::Op::Div const&>(op));
|
compiler.compile_div(static_cast<Bytecode::Op::Div const&>(op));
|
||||||
break;
|
break;
|
||||||
|
case Bytecode::Instruction::Type::Return:
|
||||||
|
compiler.compile_return(static_cast<Bytecode::Op::Return const&>(op));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
dbgln("JIT compilation failed: {}", bytecode_executable.name);
|
dbgln("JIT compilation failed: {}", bytecode_executable.name);
|
||||||
dbgln("Unsupported bytecode op: {}", op.to_deprecated_string(bytecode_executable));
|
dbgln("Unsupported bytecode op: {}", op.to_deprecated_string(bytecode_executable));
|
||||||
|
|
|
@ -45,6 +45,7 @@ private:
|
||||||
void compile_sub(Bytecode::Op::Sub const&);
|
void compile_sub(Bytecode::Op::Sub const&);
|
||||||
void compile_mul(Bytecode::Op::Mul const&);
|
void compile_mul(Bytecode::Op::Mul const&);
|
||||||
void compile_div(Bytecode::Op::Div const&);
|
void compile_div(Bytecode::Op::Div const&);
|
||||||
|
void compile_return(Bytecode::Op::Return const&);
|
||||||
|
|
||||||
void store_vm_register(Bytecode::Register, Assembler::Reg);
|
void store_vm_register(Bytecode::Register, Assembler::Reg);
|
||||||
void load_vm_register(Assembler::Reg, Bytecode::Register);
|
void load_vm_register(Assembler::Reg, Bytecode::Register);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue