mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 18:17:41 +00:00
LibJS/JIT: Compile the IteratorResultValue instruction
This commit is contained in:
parent
e7fdf9c7e5
commit
233502a10c
2 changed files with 16 additions and 1 deletions
|
@ -1269,6 +1269,20 @@ void Compiler::compile_throw_if_nullish(Bytecode::Op::ThrowIfNullish const&)
|
||||||
check_exception();
|
check_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Value cxx_iterator_result_value(VM& vm, Value iterator)
|
||||||
|
{
|
||||||
|
auto iterator_result = TRY_OR_SET_EXCEPTION(iterator.to_object(vm));
|
||||||
|
return TRY_OR_SET_EXCEPTION(iterator_value(vm, iterator_result));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Compiler::compile_iterator_result_value(Bytecode::Op::IteratorResultValue const&)
|
||||||
|
{
|
||||||
|
load_vm_register(ARG1, Bytecode::Register::accumulator());
|
||||||
|
native_call((void*)cxx_iterator_result_value);
|
||||||
|
store_vm_register(Bytecode::Register::accumulator(), RET);
|
||||||
|
check_exception();
|
||||||
|
}
|
||||||
|
|
||||||
void Compiler::jump_to_exit()
|
void Compiler::jump_to_exit()
|
||||||
{
|
{
|
||||||
m_assembler.jump(m_exit_label);
|
m_assembler.jump(m_exit_label);
|
||||||
|
|
|
@ -110,7 +110,8 @@ private:
|
||||||
O(IteratorNext, iterator_next) \
|
O(IteratorNext, iterator_next) \
|
||||||
O(IteratorResultDone, iterator_result_done) \
|
O(IteratorResultDone, iterator_result_done) \
|
||||||
O(ThrowIfNotObject, throw_if_not_object) \
|
O(ThrowIfNotObject, throw_if_not_object) \
|
||||||
O(ThrowIfNullish, throw_if_nullish)
|
O(ThrowIfNullish, throw_if_nullish) \
|
||||||
|
O(IteratorResultValue, iterator_result_value)
|
||||||
|
|
||||||
# define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \
|
# define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \
|
||||||
void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);
|
void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue