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

LibJS/JIT: Compile the GetByValueWithThis instruction

This commit is contained in:
Simon Wanner 2023-10-29 21:49:41 +01:00 committed by Andreas Kling
parent 569ca57e22
commit b53277110e
3 changed files with 22 additions and 1 deletions

View file

@ -1452,6 +1452,23 @@ void Compiler::compile_get_by_id_with_this(Bytecode::Op::GetByIdWithThis const&
check_exception();
}
static Value cxx_get_by_value_with_this(VM& vm, Value property_key_value, Value base, Value this_value)
{
auto object = TRY_OR_SET_EXCEPTION(base.to_object(vm));
auto property_key = TRY_OR_SET_EXCEPTION(property_key_value.to_property_key(vm));
return TRY_OR_SET_EXCEPTION(object->internal_get(property_key, this_value));
}
void Compiler::compile_get_by_value_with_this(Bytecode::Op::GetByValueWithThis const& op)
{
load_vm_register(ARG1, Bytecode::Register::accumulator());
load_vm_register(ARG2, op.base());
load_vm_register(ARG3, op.this_value());
native_call((void*)cxx_get_by_value_with_this);
store_vm_register(Bytecode::Register::accumulator(), RET);
check_exception();
}
void Compiler::jump_to_exit()
{
m_assembler.jump(m_exit_label);