Skip to content

Commit 233502a

Browse files
skyrisingawesomekling
authored andcommitted
LibJS/JIT: Compile the IteratorResultValue instruction
1 parent e7fdf9c commit 233502a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Userland/Libraries/LibJS/JIT/Compiler.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,20 @@ void Compiler::compile_throw_if_nullish(Bytecode::Op::ThrowIfNullish const&)
12691269
check_exception();
12701270
}
12711271

1272+
static Value cxx_iterator_result_value(VM& vm, Value iterator)
1273+
{
1274+
auto iterator_result = TRY_OR_SET_EXCEPTION(iterator.to_object(vm));
1275+
return TRY_OR_SET_EXCEPTION(iterator_value(vm, iterator_result));
1276+
}
1277+
1278+
void Compiler::compile_iterator_result_value(Bytecode::Op::IteratorResultValue const&)
1279+
{
1280+
load_vm_register(ARG1, Bytecode::Register::accumulator());
1281+
native_call((void*)cxx_iterator_result_value);
1282+
store_vm_register(Bytecode::Register::accumulator(), RET);
1283+
check_exception();
1284+
}
1285+
12721286
void Compiler::jump_to_exit()
12731287
{
12741288
m_assembler.jump(m_exit_label);

Userland/Libraries/LibJS/JIT/Compiler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ class Compiler {
110110
O(IteratorNext, iterator_next) \
111111
O(IteratorResultDone, iterator_result_done) \
112112
O(ThrowIfNotObject, throw_if_not_object) \
113-
O(ThrowIfNullish, throw_if_nullish)
113+
O(ThrowIfNullish, throw_if_nullish) \
114+
O(IteratorResultValue, iterator_result_value)
114115

115116
# define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \
116117
void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);

0 commit comments

Comments
 (0)