1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:08:13 +00:00

LibJS: Support array rest elements in the bytecode interpreter

This commit is contained in:
Matthew Olsson 2021-06-13 14:06:26 -07:00 committed by Andreas Kling
parent 7983324639
commit 57b9a228ab
4 changed files with 172 additions and 77 deletions

View file

@ -181,6 +181,12 @@ private:
// NOTE: This instruction is variable-width depending on the number of elements!
class NewArray final : public Instruction {
public:
NewArray()
: Instruction(Type::NewArray)
, m_element_count(0)
{
}
explicit NewArray(Vector<Register> const& elements)
: Instruction(Type::NewArray)
, m_element_count(elements.size())
@ -203,6 +209,18 @@ private:
Register m_elements[];
};
class IteratorToArray final : public Instruction {
public:
IteratorToArray()
: Instruction(Type::IteratorToArray)
{
}
void execute_impl(Bytecode::Interpreter&) const;
String to_string_impl(Bytecode::Executable const&) const;
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
};
class ConcatString final : public Instruction {
public:
explicit ConcatString(Register lhs)