1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

LibJS/Bytecode: Leave BlockDeclarationInstantiation in C++

Instead of implementing this AO in bytecode, we now have an instruction
for it that simply invokes the C++ implementation.

This allows us to simplify Bytecode::Generator quite a bit by removing
all the variable scope tracking.
This commit is contained in:
Andreas Kling 2023-06-16 16:34:47 +02:00
parent 4684d3fe54
commit ac246d764d
6 changed files with 56 additions and 91 deletions

View file

@ -794,6 +794,23 @@ private:
Optional<Register> m_home_object;
};
class BlockDeclarationInstantiation final : public Instruction {
public:
explicit BlockDeclarationInstantiation(ScopeNode const& scope_node)
: Instruction(Type::BlockDeclarationInstantiation)
, m_scope_node(scope_node)
{
}
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
void replace_references_impl(Register, Register) { }
private:
ScopeNode const& m_scope_node;
};
class Return final : public Instruction {
public:
constexpr static bool IsTerminator = true;