1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibJS/JIT: Compile the GetByIdWithThis instruction

This commit is contained in:
Simon Wanner 2023-10-29 21:39:02 +01:00 committed by Andreas Kling
parent ad81f49b02
commit 569ca57e22
3 changed files with 27 additions and 1 deletions

View file

@ -16,6 +16,7 @@
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/DeclarativeEnvironment.h>
#include <LibJS/Runtime/ECMAScriptFunctionObject.h>
#include <LibJS/Runtime/FunctionEnvironment.h>
#include <LibJS/Runtime/VM.h>
#include <LibJS/Runtime/ValueInlines.h>
#include <sys/mman.h>
@ -1431,6 +1432,26 @@ void Compiler::compile_resolve_super_base(Bytecode::Op::ResolveSuperBase const&)
check_exception();
}
static Value cxx_get_by_id_with_this(VM& vm, Bytecode::IdentifierTableIndex property, Value base_value, Value this_value, u32 cache_index)
{
return TRY_OR_SET_EXCEPTION(get_by_id(vm.bytecode_interpreter(), property, base_value, this_value, cache_index));
}
void Compiler::compile_get_by_id_with_this(Bytecode::Op::GetByIdWithThis const& op)
{
m_assembler.mov(
Assembler::Operand::Register(ARG1),
Assembler::Operand::Imm(op.property().value()));
load_vm_register(ARG2, Bytecode::Register::accumulator());
load_vm_register(ARG3, op.this_value());
m_assembler.mov(
Assembler::Operand::Register(ARG4),
Assembler::Operand::Imm(op.cache_index()));
native_call((void*)cxx_get_by_id_with_this);
store_vm_register(Bytecode::Register::accumulator(), RET);
check_exception();
}
void Compiler::jump_to_exit()
{
m_assembler.jump(m_exit_label);