mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:28:11 +00:00
LibJS: Make one compact allocation for CallExpression and its Arguments
Instead of CallExpression storing its arguments in a Vector<Argument>, we now custom-allocate the memory slot for CallExpression (and its subclass NewExpression) so that it fits both CallExpression and its list of Arguments in one allocation. This reduces memory usage on twitter.com/awesomekling by 8.8 MiB :^)
This commit is contained in:
parent
8a8d8ecb35
commit
b894acd6b2
4 changed files with 56 additions and 32 deletions
|
@ -2350,7 +2350,7 @@ NonnullRefPtr<Expression> Parser::parse_call_expression(NonnullRefPtr<Expression
|
|||
if (is<SuperExpression>(*lhs))
|
||||
return create_ast_node<SuperCall>({ m_source_code, rule_start.position(), position() }, move(arguments));
|
||||
|
||||
return create_ast_node<CallExpression>({ m_source_code, rule_start.position(), position() }, move(lhs), move(arguments));
|
||||
return CallExpression::create({ m_source_code, rule_start.position(), position() }, move(lhs), arguments.span());
|
||||
}
|
||||
|
||||
NonnullRefPtr<NewExpression> Parser::parse_new_expression()
|
||||
|
@ -2380,7 +2380,7 @@ NonnullRefPtr<NewExpression> Parser::parse_new_expression()
|
|||
consume(TokenType::ParenClose);
|
||||
}
|
||||
|
||||
return create_ast_node<NewExpression>({ m_source_code, rule_start.position(), position() }, move(callee), move(arguments));
|
||||
return NewExpression::create({ m_source_code, rule_start.position(), position() }, move(callee), move(arguments));
|
||||
}
|
||||
|
||||
NonnullRefPtr<YieldExpression> Parser::parse_yield_expression()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue