mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
LibJS/JIT: Compile the ThrowIfNotObject instruction
This commit is contained in:
parent
39deb365d2
commit
9e2edc3085
Notes:
sideshowbarker
2024-07-17 00:23:42 +09:00
Author: https://github.com/skyrising Commit: https://github.com/SerenityOS/serenity/commit/9e2edc3085 Pull-request: https://github.com/SerenityOS/serenity/pull/21677
2 changed files with 16 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -108,7 +108,8 @@ private:
|
|||
O(SuperCallWithArgumentArray, super_call_with_argument_array) \
|
||||
O(GetIterator, get_iterator) \
|
||||
O(IteratorNext, iterator_next) \
|
||||
O(IteratorResultDone, iterator_result_done)
|
||||
O(IteratorResultDone, iterator_result_done) \
|
||||
O(ThrowIfNotObject, throw_if_not_object)
|
||||
|
||||
# define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \
|
||||
void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);
|
||||
|
|
Loading…
Reference in a new issue