mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
LibJS: Make class-specific members of ESFO lazily allocated
We don't need the [[Fields]] and [[PrivateMethods]] slots for most ESFO instances, so let's reduce their impact on class size! This shrinks ESFO from 200 bytes to 160 bytes, allowing more allocations before we have to collect garbage.
This commit is contained in:
parent
2a9b6f1d97
commit
4593e19bcf
Notes:
github-actions[bot]
2025-04-08 16:53:42 +00:00
Author: https://github.com/awesomekling
Commit: 4593e19bcf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4283
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/trflynn89
3 changed files with 40 additions and 20 deletions
|
@ -699,6 +699,10 @@ ThrowCompletionOr<void> Object::define_field(ClassFieldDefinition const& field)
|
|||
// 7.3.34 InitializeInstanceElements ( O, constructor ), https://tc39.es/ecma262/#sec-initializeinstanceelements
|
||||
ThrowCompletionOr<void> Object::initialize_instance_elements(ECMAScriptFunctionObject& constructor)
|
||||
{
|
||||
// AD-HOC: Avoid lazy instantiation of ECMAScriptFunctionObject::ClassData.
|
||||
if (!constructor.has_class_data())
|
||||
return {};
|
||||
|
||||
// 1. Let methods be the value of constructor.[[PrivateMethods]].
|
||||
// 2. For each PrivateElement method of methods, do
|
||||
for (auto const& method : constructor.private_methods()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue