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

LibJS/JIT: Compile the ResolveSuperBase instruction

This commit is contained in:
Simon Wanner 2023-10-29 21:32:33 +01:00 committed by Andreas Kling
parent 4e9edb8c53
commit ad81f49b02
2 changed files with 21 additions and 1 deletions

View file

@ -1412,6 +1412,25 @@ void Compiler::compile_get_private_by_id(Bytecode::Op::GetPrivateById const& op)
check_exception();
}
static Value cxx_resolve_super_base(VM& vm)
{
// 1. Let env be GetThisEnvironment().
auto& env = verify_cast<FunctionEnvironment>(*get_this_environment(vm));
// 2. Assert: env.HasSuperBinding() is true.
VERIFY(env.has_super_binding());
// 3. Let baseValue be ? env.GetSuperBase().
return TRY_OR_SET_EXCEPTION(env.get_super_base());
}
void Compiler::compile_resolve_super_base(Bytecode::Op::ResolveSuperBase const&)
{
native_call((void*)cxx_resolve_super_base);
store_vm_register(Bytecode::Register::accumulator(), RET);
check_exception();
}
void Compiler::jump_to_exit()
{
m_assembler.jump(m_exit_label);

View file

@ -120,7 +120,8 @@ private:
O(DeleteByValue, delete_by_value) \
O(DeleteByValueWithThis, delete_by_value_with_this) \
O(GetObjectPropertyIterator, get_object_property_iterator) \
O(GetPrivateById, get_private_by_id)
O(GetPrivateById, get_private_by_id) \
O(ResolveSuperBase, resolve_super_base)
# define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \
void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);