From d74bb87d469b29ead6e39337e7eaf5fadc288c71 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 21 Sep 2020 15:30:14 +0200 Subject: [PATCH] LibJS: Add a way to get from a Cell to the VM --- Libraries/LibJS/Runtime/Cell.cpp | 5 +++++ Libraries/LibJS/Runtime/Cell.h | 1 + 2 files changed, 6 insertions(+) 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;