diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-03 18:26:13 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-07 18:11:59 +0200 |
commit | 6da5d17416f86443e320ac60a0f046d7ddf24dc8 (patch) | |
tree | 67cfc4a4e22d531956e1b9daa4379098177284d2 | |
parent | 69dddd4ef58e51fb0db881b3b6801492b5f86285 (diff) | |
download | serenity-6da5d17416f86443e320ac60a0f046d7ddf24dc8.zip |
LibJS: Add a VM accessor to Bytecode::Interpreter :^)
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Interpreter.h | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index df4ead07ac..0640176925 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -7,11 +7,13 @@ #include <LibJS/Bytecode/Block.h> #include <LibJS/Bytecode/Instruction.h> #include <LibJS/Bytecode/Interpreter.h> +#include <LibJS/Runtime/GlobalObject.h> 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 0a08ea9c69..70b65fdb6a 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<Value> m_registers; }; |