1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 22:05:07 +00:00

LibJS: Partially revert 12b283f

This commit partially reverts "LibJS: Make accessing the current
function's arguments cheaper".
While the change passed all the currently passing test262 tests, it
seems to have _some_ flaw that silently breaks with some real-world
websites.
As the speedup with negligible at best, let's just revert it until we
can implement it more correctly.
This commit is contained in:
Ali Mohammad Pur 2021-10-08 19:56:02 +03:30
parent fa6c06ce8d
commit 13138811df
4 changed files with 0 additions and 107 deletions

View file

@ -1534,30 +1534,6 @@ NonnullRefPtr<Expression> Parser::parse_expression(int min_precedence, Associati
if (identifier_instance->string() == "arguments"sv)
m_state.current_scope_pusher->set_contains_access_to_arguments_object();
}
if (function_scope && has_not_been_declared_as_variable) {
auto& parameters = function_scope->function_parameters();
Optional<size_t> argument_index;
size_t index = 0;
for (auto& parameter : parameters) {
auto current_index = index++;
if (parameter.is_rest)
break;
if (auto name_ptr = parameter.binding.get_pointer<FlyString>()) {
// Need VM assistance for this, so let's just pretend it's not there.
if (parameter.default_value)
break;
if (identifier_instance->string() == *name_ptr) {
argument_index = current_index;
if (m_state.strict_mode)
break;
}
}
}
if (argument_index.has_value())
m_state.current_scope_pusher->associate_identifier_with_argument_index(identifier_instance, *argument_index);
}
}
while (match(TokenType::TemplateLiteralStart)) {