1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00

LibJS: Store Module::environment() as ModuleEnvironment

Let's use a more specific type here to allow for devirtualization.
This commit is contained in:
Andreas Kling 2025-03-16 17:41:24 -05:00 committed by Andreas Kling
parent 603df37a88
commit 8fcff2fa18
Notes: github-actions[bot] 2025-03-20 17:52:55 +00:00
6 changed files with 16 additions and 13 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2021-2025, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2022, David Tuin <davidot@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
@ -100,7 +100,7 @@ public:
StringView filename() const { return m_filename; }
Environment* environment() { return m_environment; }
GC::Ptr<ModuleEnvironment> environment() { return m_environment; }
Script::HostDefined* host_defined() const { return m_host_defined; }
@ -122,7 +122,7 @@ protected:
virtual void visit_edges(Cell::Visitor&) override;
void set_environment(Environment* environment)
void set_environment(GC::Ref<ModuleEnvironment> environment)
{
m_environment = environment;
}
@ -136,7 +136,7 @@ private:
// stores modules with a RefPtr we cannot just store the VM as that leads to
// cycles.
GC::Ptr<Realm> m_realm; // [[Realm]]
GC::Ptr<Environment> m_environment; // [[Environment]]
GC::Ptr<ModuleEnvironment> m_environment; // [[Environment]]
GC::Ptr<Object> m_namespace; // [[Namespace]]
Script::HostDefined* m_host_defined { nullptr }; // [[HostDefined]]