Kaynağa Gözat

LibJS: Add a VM accessor to Bytecode::Interpreter :^)

Andreas Kling 4 yıl önce
ebeveyn
işleme
6da5d17416

+ 3 - 1
Userland/Libraries/LibJS/Bytecode/Interpreter.cpp

@@ -7,11 +7,13 @@
 #include <LibJS/Bytecode/Block.h>
 #include <LibJS/Bytecode/Block.h>
 #include <LibJS/Bytecode/Instruction.h>
 #include <LibJS/Bytecode/Instruction.h>
 #include <LibJS/Bytecode/Interpreter.h>
 #include <LibJS/Bytecode/Interpreter.h>
+#include <LibJS/Runtime/GlobalObject.h>
 
 
 namespace JS::Bytecode {
 namespace JS::Bytecode {
 
 
 Interpreter::Interpreter(GlobalObject& global_object)
 Interpreter::Interpreter(GlobalObject& global_object)
-    : m_global_object(global_object)
+    : m_vm(global_object.vm())
+    , m_global_object(global_object)
 {
 {
 }
 }
 
 

+ 2 - 0
Userland/Libraries/LibJS/Bytecode/Interpreter.h

@@ -19,12 +19,14 @@ public:
     ~Interpreter();
     ~Interpreter();
 
 
     GlobalObject& global_object() { return m_global_object; }
     GlobalObject& global_object() { return m_global_object; }
+    VM& vm() { return m_vm; }
 
 
     void run(Bytecode::Block const&);
     void run(Bytecode::Block const&);
 
 
     Value& reg(Register const& r) { return m_registers[r.index()]; }
     Value& reg(Register const& r) { return m_registers[r.index()]; }
 
 
 private:
 private:
+    VM& m_vm;
     GlobalObject& m_global_object;
     GlobalObject& m_global_object;
     Vector<Value> m_registers;
     Vector<Value> m_registers;
 };
 };