mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
LibJS/JIT: Compile the GetIterator instruction
This commit is contained in:
parent
d416cef9bb
commit
4f8f8b7792
Notes:
sideshowbarker
2024-07-17 18:06:52 +09:00
Author: https://github.com/skyrising Commit: https://github.com/SerenityOS/serenity/commit/4f8f8b7792 Pull-request: https://github.com/SerenityOS/serenity/pull/21677
3 changed files with 21 additions and 1 deletions
|
@ -1299,6 +1299,8 @@ public:
|
|||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
|
||||
IteratorHint hint() const { return m_hint; }
|
||||
|
||||
private:
|
||||
IteratorHint m_hint { IteratorHint::Sync };
|
||||
};
|
||||
|
|
|
@ -1195,6 +1195,23 @@ void Compiler::compile_super_call_with_argument_array(Bytecode::Op::SuperCallWit
|
|||
check_exception();
|
||||
}
|
||||
|
||||
static Value cxx_get_iterator(VM& vm, Value value, IteratorHint hint)
|
||||
{
|
||||
auto iterator = TRY_OR_SET_EXCEPTION(get_iterator(vm, value, hint));
|
||||
return Bytecode::iterator_to_object(vm, iterator);
|
||||
}
|
||||
|
||||
void Compiler::compile_get_iterator(Bytecode::Op::GetIterator const& op)
|
||||
{
|
||||
load_vm_register(ARG1, Bytecode::Register::accumulator());
|
||||
m_assembler.mov(
|
||||
Assembler::Operand::Register(ARG2),
|
||||
Assembler::Operand::Imm(to_underlying(op.hint())));
|
||||
native_call((void*)cxx_get_iterator);
|
||||
store_vm_register(Bytecode::Register::accumulator(), RET);
|
||||
check_exception();
|
||||
}
|
||||
|
||||
void Compiler::jump_to_exit()
|
||||
{
|
||||
m_assembler.jump(m_exit_label);
|
||||
|
|
|
@ -105,7 +105,8 @@ private:
|
|||
O(ContinuePendingUnwind, continue_pending_unwind) \
|
||||
O(ConcatString, concat_string) \
|
||||
O(BlockDeclarationInstantiation, block_declaration_instantiation) \
|
||||
O(SuperCallWithArgumentArray, super_call_with_argument_array)
|
||||
O(SuperCallWithArgumentArray, super_call_with_argument_array) \
|
||||
O(GetIterator, get_iterator)
|
||||
|
||||
# define DECLARE_COMPILE_OP(OpTitleCase, op_snake_case) \
|
||||
void compile_##op_snake_case(Bytecode::Op::OpTitleCase const&);
|
||||
|
|
Loading…
Reference in a new issue