Interpreter.h 666 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Bytecode/Register.h>
  8. #include <LibJS/Forward.h>
  9. #include <LibJS/Heap/Cell.h>
  10. #include <LibJS/Runtime/Value.h>
  11. namespace JS::Bytecode {
  12. class Interpreter {
  13. public:
  14. explicit Interpreter(GlobalObject&);
  15. ~Interpreter();
  16. GlobalObject& global_object() { return m_global_object; }
  17. VM& vm() { return m_vm; }
  18. void run(Bytecode::Block const&);
  19. Value& reg(Register const& r) { return m_registers[r.index()]; }
  20. private:
  21. VM& m_vm;
  22. GlobalObject& m_global_object;
  23. Vector<Value> m_registers;
  24. };
  25. }