summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-21 15:30:14 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-22 20:10:20 +0200
commitd74bb87d469b29ead6e39337e7eaf5fadc288c71 (patch)
tree2302eac63bdb705eccfc3e284fc69207f7b25c3d
parent4a8bfcdd1cba2f79ec8bdcdc327ecfb4e497196f (diff)
downloadserenity-d74bb87d469b29ead6e39337e7eaf5fadc288c71.zip
LibJS: Add a way to get from a Cell to the VM
-rw-r--r--Libraries/LibJS/Runtime/Cell.cpp5
-rw-r--r--Libraries/LibJS/Runtime/Cell.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibJS/Runtime/Cell.cpp b/Libraries/LibJS/Runtime/Cell.cpp
index 4c8cb69511..3b4f652d4a 100644
--- a/Libraries/LibJS/Runtime/Cell.cpp
+++ b/Libraries/LibJS/Runtime/Cell.cpp
@@ -51,6 +51,11 @@ Heap& Cell::heap() const
return HeapBlock::from_cell(this)->heap();
}
+VM& Cell::vm() const
+{
+ return heap().vm();
+}
+
Interpreter& Cell::interpreter()
{
return heap().interpreter();
diff --git a/Libraries/LibJS/Runtime/Cell.h b/Libraries/LibJS/Runtime/Cell.h
index 70110f0d0d..0c1388924c 100644
--- a/Libraries/LibJS/Runtime/Cell.h
+++ b/Libraries/LibJS/Runtime/Cell.h
@@ -60,6 +60,7 @@ public:
virtual void visit_children(Visitor&) { }
Heap& heap() const;
+ VM& vm() const;
Interpreter& interpreter();
Interpreter& interpreter() const;