1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:57:34 +00:00

LibJS/JIT: Compile the Append instruction

This commit is contained in:
Simon Wanner 2023-10-29 17:25:49 +01:00 committed by Andreas Kling
parent 516bb01082
commit 40064d872f
3 changed files with 22 additions and 1 deletions

View file

@ -1319,6 +1319,23 @@ void Compiler::compile_iterator_to_array(Bytecode::Op::IteratorToArray const&)
check_exception();
}
static Value cxx_append(VM& vm, Value lhs, Value rhs, bool is_spread)
{
TRY_OR_SET_EXCEPTION(Bytecode::append(vm, lhs, rhs, is_spread));
return {};
}
void Compiler::compile_append(Bytecode::Op::Append const& op)
{
load_vm_register(ARG1, op.lhs());
load_vm_register(ARG2, Bytecode::Register::accumulator());
m_assembler.mov(
Assembler::Operand::Register(ARG3),
Assembler::Operand::Imm(static_cast<u64>(op.is_spread())));
native_call((void*)cxx_append);
check_exception();
}
void Compiler::jump_to_exit()
{
m_assembler.jump(m_exit_label);