summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibJS/Runtime/ExecutionContext.cpp17
-rw-r--r--Userland/Libraries/LibJS/Runtime/ExecutionContext.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ExecutionContext.cpp b/Userland/Libraries/LibJS/Runtime/ExecutionContext.cpp
index 51a3ff21df..5ff2b39fdc 100644
--- a/Userland/Libraries/LibJS/Runtime/ExecutionContext.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ExecutionContext.cpp
@@ -7,6 +7,7 @@
*/
#include <LibJS/Runtime/ExecutionContext.h>
+#include <LibJS/Runtime/FunctionObject.h>
namespace JS {
@@ -38,4 +39,20 @@ ExecutionContext ExecutionContext::copy() const
return copy;
}
+void ExecutionContext::visit_edges(Cell::Visitor& visitor)
+{
+ visitor.visit(function);
+ visitor.visit(realm);
+ visitor.visit(variable_environment);
+ visitor.visit(lexical_environment);
+ visitor.visit(private_environment);
+ visitor.visit(context_owner);
+ visitor.visit(this_value);
+ script_or_module.visit(
+ [](Empty) {},
+ [&](auto& script_or_module) {
+ visitor.visit(script_or_module);
+ });
+}
+
}
diff --git a/Userland/Libraries/LibJS/Runtime/ExecutionContext.h b/Userland/Libraries/LibJS/Runtime/ExecutionContext.h
index 3ac2f88521..4397604b0b 100644
--- a/Userland/Libraries/LibJS/Runtime/ExecutionContext.h
+++ b/Userland/Libraries/LibJS/Runtime/ExecutionContext.h
@@ -26,6 +26,8 @@ struct ExecutionContext {
[[nodiscard]] ExecutionContext copy() const;
+ void visit_edges(Cell::Visitor&);
+
private:
explicit ExecutionContext(MarkedVector<Value> existing_arguments);