From 6da5d17416f86443e320ac60a0f046d7ddf24dc8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 3 Jun 2021 18:26:13 +0200 Subject: [PATCH] LibJS: Add a VM accessor to Bytecode::Interpreter :^) --- Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 4 +++- Userland/Libraries/LibJS/Bytecode/Interpreter.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index df4ead07aca..06401769254 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -7,11 +7,13 @@ #include #include #include +#include namespace JS::Bytecode { Interpreter::Interpreter(GlobalObject& global_object) - : m_global_object(global_object) + : m_vm(global_object.vm()) + , m_global_object(global_object) { } diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.h b/Userland/Libraries/LibJS/Bytecode/Interpreter.h index 0a08ea9c695..70b65fdb6a0 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.h +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.h @@ -19,12 +19,14 @@ public: ~Interpreter(); GlobalObject& global_object() { return m_global_object; } + VM& vm() { return m_vm; } void run(Bytecode::Block const&); Value& reg(Register const& r) { return m_registers[r.index()]; } private: + VM& m_vm; GlobalObject& m_global_object; Vector m_registers; };