File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,6 @@ void ExecutionContext::visit_edges(Cell::Visitor& visitor)
144144 visitor.visit (variable_environment);
145145 visitor.visit (lexical_environment);
146146 visitor.visit (private_environment);
147- visitor.visit (context_owner);
148147 visitor.visit (cached_source_range);
149148 visitor.visit (m_rare_data);
150149 if (this_value.has_value ())
@@ -161,6 +160,7 @@ void ExecutionContext::visit_edges(Cell::Visitor& visitor)
161160void ExecutionContextRareData::visit_edges (Cell::Visitor& visitor)
162161{
163162 Base::visit_edges (visitor);
163+ visitor.visit (context_owner);
164164 for (auto & context : unwind_contexts) {
165165 visitor.visit (context.lexical_environment );
166166 }
@@ -170,7 +170,7 @@ void ExecutionContextRareData::visit_edges(Cell::Visitor& visitor)
170170GC::Ref<ExecutionContextRareData> ExecutionContext::ensure_rare_data ()
171171{
172172 if (!m_rare_data) {
173- m_rare_data = executable-> heap ().allocate <ExecutionContextRareData>();
173+ m_rare_data = GC::Heap::the ().allocate <ExecutionContextRareData>();
174174 }
175175 return *m_rare_data;
176176}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class CachedSourceRange final : public GC::Cell {
3636 Variant<UnrealizedSourceRange, SourceRange> source_range;
3737};
3838
39- class ExecutionContextRareData final : public GC::Cell {
39+ class JS_API ExecutionContextRareData final : public GC::Cell {
4040 GC_CELL (ExecutionContextRareData, GC::Cell);
4141 GC_DECLARE_ALLOCATOR (ExecutionContextRareData);
4242
@@ -45,6 +45,9 @@ class ExecutionContextRareData final : public GC::Cell {
4545 Vector<Optional<size_t >> previously_scheduled_jumps;
4646 Vector<GC::Ptr<Environment>> saved_lexical_environments;
4747
48+ // Non-standard: This points at something that owns this ExecutionContext, in case it needs to be protected from GC.
49+ GC::Ptr<Cell> context_owner;
50+
4851private:
4952 virtual void visit_edges (Cell::Visitor&) override ;
5053};
@@ -82,9 +85,6 @@ struct JS_API ExecutionContext {
8285 Span<Value> registers_and_constants_and_locals_arguments;
8386 ReadonlySpan<Utf16FlyString> identifier_table;
8487
85- // Non-standard: This points at something that owns this ExecutionContext, in case it needs to be protected from GC.
86- GC::Ptr<Cell> context_owner;
87-
8888 u32 program_counter { 0 };
8989
9090 // https://html.spec.whatwg.org/multipage/webappapis.html#skip-when-determining-incumbent-counter
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ void Environment::visit_edges(Cell::Visitor& visitor)
3838EnvironmentSettingsObject::EnvironmentSettingsObject (NonnullOwnPtr<JS::ExecutionContext> realm_execution_context)
3939 : m_realm_execution_context(move(realm_execution_context))
4040{
41- m_realm_execution_context->context_owner = this ;
41+ m_realm_execution_context->ensure_rare_data ()-> context_owner = this ;
4242
4343 // Register with the responsible event loop so we can perform step 4 of "perform a microtask checkpoint".
4444 responsible_event_loop ().register_environment_settings_object ({}, *this );
You can’t perform that action at this time.
0 commit comments