mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
LibJS: Move ExecutionContext::context_owner to rare data
This is only used by ExecutionContexts owned by an HTML::ESO.
This commit is contained in:
parent
d234e9ee71
commit
e1344afff3
|
|
@ -144,7 +144,6 @@ void ExecutionContext::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(variable_environment);
|
||||
visitor.visit(lexical_environment);
|
||||
visitor.visit(private_environment);
|
||||
visitor.visit(context_owner);
|
||||
visitor.visit(cached_source_range);
|
||||
visitor.visit(m_rare_data);
|
||||
if (this_value.has_value())
|
||||
|
|
@ -161,6 +160,7 @@ void ExecutionContext::visit_edges(Cell::Visitor& visitor)
|
|||
void ExecutionContextRareData::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(context_owner);
|
||||
for (auto& context : unwind_contexts) {
|
||||
visitor.visit(context.lexical_environment);
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ void ExecutionContextRareData::visit_edges(Cell::Visitor& visitor)
|
|||
GC::Ref<ExecutionContextRareData> ExecutionContext::ensure_rare_data()
|
||||
{
|
||||
if (!m_rare_data) {
|
||||
m_rare_data = executable->heap().allocate<ExecutionContextRareData>();
|
||||
m_rare_data = GC::Heap::the().allocate<ExecutionContextRareData>();
|
||||
}
|
||||
return *m_rare_data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public:
|
|||
Variant<UnrealizedSourceRange, SourceRange> source_range;
|
||||
};
|
||||
|
||||
class ExecutionContextRareData final : public GC::Cell {
|
||||
class JS_API ExecutionContextRareData final : public GC::Cell {
|
||||
GC_CELL(ExecutionContextRareData, GC::Cell);
|
||||
GC_DECLARE_ALLOCATOR(ExecutionContextRareData);
|
||||
|
||||
|
|
@ -45,6 +45,9 @@ public:
|
|||
Vector<Optional<size_t>> previously_scheduled_jumps;
|
||||
Vector<GC::Ptr<Environment>> saved_lexical_environments;
|
||||
|
||||
// Non-standard: This points at something that owns this ExecutionContext, in case it needs to be protected from GC.
|
||||
GC::Ptr<Cell> context_owner;
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
};
|
||||
|
|
@ -82,9 +85,6 @@ public:
|
|||
Span<Value> registers_and_constants_and_locals_arguments;
|
||||
ReadonlySpan<Utf16FlyString> identifier_table;
|
||||
|
||||
// Non-standard: This points at something that owns this ExecutionContext, in case it needs to be protected from GC.
|
||||
GC::Ptr<Cell> context_owner;
|
||||
|
||||
u32 program_counter { 0 };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#skip-when-determining-incumbent-counter
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void Environment::visit_edges(Cell::Visitor& visitor)
|
|||
EnvironmentSettingsObject::EnvironmentSettingsObject(NonnullOwnPtr<JS::ExecutionContext> realm_execution_context)
|
||||
: m_realm_execution_context(move(realm_execution_context))
|
||||
{
|
||||
m_realm_execution_context->context_owner = this;
|
||||
m_realm_execution_context->ensure_rare_data()->context_owner = this;
|
||||
|
||||
// Register with the responsible event loop so we can perform step 4 of "perform a microtask checkpoint".
|
||||
responsible_event_loop().register_environment_settings_object({}, *this);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user