mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 02:29:21 +00:00
LibJS: Implement array destructuring for the bytecode interpreter
This commit is contained in:
parent
14fff5df06
commit
7983324639
Notes:
sideshowbarker
2024-07-18 12:02:26 +09:00
Author: https://github.com/mattco98
Commit: 7983324639
Pull-request: https://github.com/SerenityOS/serenity/pull/8033
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/awesomekling
4 changed files with 267 additions and 50 deletions
|
@ -582,6 +582,7 @@ public:
|
|||
, m_variables(move(variables))
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
|
@ -606,6 +607,54 @@ private:
|
|||
size_t m_index { 0 };
|
||||
};
|
||||
|
||||
class GetIterator final : public Instruction {
|
||||
public:
|
||||
GetIterator()
|
||||
: Instruction(Type::GetIterator)
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
};
|
||||
|
||||
class IteratorNext final : public Instruction {
|
||||
public:
|
||||
IteratorNext()
|
||||
: Instruction(Type::IteratorNext)
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
};
|
||||
|
||||
class IteratorResultDone final : public Instruction {
|
||||
public:
|
||||
IteratorResultDone()
|
||||
: Instruction(Type::IteratorResultDone)
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
};
|
||||
|
||||
class IteratorResultValue final : public Instruction {
|
||||
public:
|
||||
IteratorResultValue()
|
||||
: Instruction(Type::IteratorResultValue)
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue