mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
LibJS: Add modification counter in DeclarativeEnvironment
This counter is incremented whenever a mutating operation occurs within the environment's set of bindings. It is going to be used by GetGlobal instruction to correctly invalidate cache when global declarative environment is mutated.
This commit is contained in:
committed by
Andreas Kling
parent
b0a533dbc0
commit
a27c4cf63c
@@ -77,6 +77,8 @@ ThrowCompletionOr<void> DeclarativeEnvironment::create_mutable_binding(VM&, Depr
|
||||
.initialized = false,
|
||||
});
|
||||
|
||||
++m_environment_serial_number;
|
||||
|
||||
// 3. Return unused.
|
||||
return {};
|
||||
}
|
||||
@@ -97,6 +99,8 @@ ThrowCompletionOr<void> DeclarativeEnvironment::create_immutable_binding(VM&, De
|
||||
.initialized = false,
|
||||
});
|
||||
|
||||
++m_environment_serial_number;
|
||||
|
||||
// 3. Return unused.
|
||||
return {};
|
||||
}
|
||||
@@ -217,6 +221,8 @@ ThrowCompletionOr<bool> DeclarativeEnvironment::delete_binding(VM&, DeprecatedFl
|
||||
// NOTE: We keep the entries in m_bindings to avoid disturbing indices.
|
||||
binding_and_index->binding() = {};
|
||||
|
||||
++m_environment_serial_number;
|
||||
|
||||
// 4. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user