mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibJS: Make accessing the current function's arguments cheaper
Instead of going through an environment record, make arguments of the currently executing function generate references via the argument index, which can later be resolved directly through the ExecutionContext.
This commit is contained in:
committed by
Andreas Kling
parent
da296ffd56
commit
12b283f32f
@@ -1011,10 +1011,30 @@ Reference Identifier::to_reference(Interpreter& interpreter, GlobalObject&) cons
|
||||
environment = environment->outer_environment();
|
||||
VERIFY(environment);
|
||||
VERIFY(environment->is_declarative_environment());
|
||||
if (!environment->is_permanently_screwed_by_eval())
|
||||
if (!environment->is_permanently_screwed_by_eval()) {
|
||||
if (m_lexically_bound_function_argument.has_value()) {
|
||||
return Reference {
|
||||
*environment,
|
||||
string(),
|
||||
*m_lexically_bound_function_argument,
|
||||
interpreter.vm().in_strict_mode(),
|
||||
m_cached_environment_coordinate,
|
||||
&interpreter.vm().running_execution_context(),
|
||||
};
|
||||
}
|
||||
return Reference { *environment, string(), interpreter.vm().in_strict_mode(), m_cached_environment_coordinate };
|
||||
}
|
||||
m_cached_environment_coordinate = {};
|
||||
}
|
||||
if (m_lexically_bound_function_argument.has_value()) {
|
||||
return Reference {
|
||||
string(),
|
||||
*m_lexically_bound_function_argument,
|
||||
interpreter.vm().in_strict_mode(),
|
||||
&interpreter.vm().running_execution_context(),
|
||||
};
|
||||
}
|
||||
|
||||
auto reference = interpreter.vm().resolve_binding(string());
|
||||
if (reference.environment_coordinate().has_value())
|
||||
m_cached_environment_coordinate = reference.environment_coordinate();
|
||||
|
||||
Reference in New Issue
Block a user