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

LibJS/JIT: Compile the ThrowIfNotObject instruction

This commit is contained in:
Simon Wanner 2023-10-29 16:09:44 +01:00 committed by Andreas Kling
parent 39deb365d2
commit 9e2edc3085
2 changed files with 16 additions and 1 deletions

View file

@ -1241,6 +1241,20 @@ void Compiler::compile_iterator_result_done(Bytecode::Op::IteratorResultDone con
check_exception();
}
static Value cxx_throw_if_not_object(VM& vm, Value value)
{
if (!value.is_object())
TRY_OR_SET_EXCEPTION(vm.throw_completion<TypeError>(ErrorType::NotAnObject, value.to_string_without_side_effects()));
return {};
}
void Compiler::compile_throw_if_not_object(Bytecode::Op::ThrowIfNotObject const&)
{
load_vm_register(ARG1, Bytecode::Register::accumulator());
native_call((void*)cxx_throw_if_not_object);
check_exception();
}
void Compiler::jump_to_exit()
{
m_assembler.jump(m_exit_label);