mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 07:22:21 +00:00
LibJS: Simplify ECMAScriptFunctionObject.[[Realm]] slot handling
Our engine already keeps track of the home realm for all objects. This is stored in Shape::realm(). We can use that instead of having a dedicated member in ESFO for the same pointer. Since there's always a home realm these days, we can also remove some outdated fallback code from the days when having a realm was not guaranteed due to LibWeb shenanigans.
This commit is contained in:
parent
e4941a36b0
commit
6db20a9453
Notes:
github-actions[bot]
2025-04-12 09:08:41 +00:00
Author: https://github.com/awesomekling
Commit: 6db20a9453
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4328
2 changed files with 4 additions and 29 deletions
|
@ -135,7 +135,7 @@ public:
|
|||
auto& bytecode_executable() const { return m_bytecode_executable; }
|
||||
|
||||
Environment* environment() { return m_environment; }
|
||||
virtual Realm* realm() const override { return m_realm; }
|
||||
virtual Realm* realm() const override { return &shape().realm(); }
|
||||
|
||||
[[nodiscard]] ConstructorKind constructor_kind() const { return shared_data().m_constructor_kind; }
|
||||
void set_constructor_kind(ConstructorKind constructor_kind) { const_cast<SharedFunctionInstanceData&>(shared_data()).m_constructor_kind = constructor_kind; }
|
||||
|
@ -210,7 +210,6 @@ private:
|
|||
// Internal Slots of ECMAScript Function Objects, https://tc39.es/ecma262/#table-internal-slots-of-ecmascript-function-objects
|
||||
GC::Ptr<Environment> m_environment; // [[Environment]]
|
||||
GC::Ptr<PrivateEnvironment> m_private_environment; // [[PrivateEnvironment]]
|
||||
GC::Ptr<Realm> m_realm; // [[Realm]]
|
||||
ScriptOrModule m_script_or_module; // [[ScriptOrModule]]
|
||||
GC::Ptr<Object> m_home_object; // [[HomeObject]]
|
||||
struct ClassData {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue