LibJS: Shrink DeclarativeEnvironment bindings vector to fit

After setting up all the bindings in function_declaration_instantiation,
we now ask DeclarativeEnvironment to do a shrink_to_fit() on its vector
of bindings.

This ends up saving 5.6 MiB on twitter.com/awesomekling :^)
This commit is contained in:
Andreas Kling 2022-11-26 20:33:52 +01:00 committed by Linus Groh
commit 2e98c17347
Notes: sideshowbarker 2024-07-17 03:36:30 +09:00
3 changed files with 12 additions and 0 deletions

View file

@ -57,6 +57,8 @@ public:
ThrowCompletionOr<void> set_mutable_binding_direct(VM&, size_t index, Value, bool strict);
ThrowCompletionOr<Value> get_binding_value_direct(VM&, size_t index, bool strict);
void shrink_to_fit();
private:
ThrowCompletionOr<void> initialize_binding_direct(VM&, Binding&, Value);
ThrowCompletionOr<Value> get_binding_value_direct(VM&, Binding&, bool strict);