1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:07:36 +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:
Ali Mohammad Pur 2021-10-07 20:13:22 +03:30 committed by Andreas Kling
parent da296ffd56
commit 12b283f32f
5 changed files with 207 additions and 4 deletions

View file

@ -982,6 +982,7 @@ public:
}
FlyString const& string() const { return m_string; }
void set_lexically_bound_function_argument_index(size_t index) { m_lexically_bound_function_argument = index; }
virtual Value execute(Interpreter&, GlobalObject&) const override;
virtual void dump(int indent) const override;
@ -992,6 +993,7 @@ private:
virtual bool is_identifier() const override { return true; }
FlyString m_string;
Optional<size_t> m_lexically_bound_function_argument;
mutable Optional<EnvironmentCoordinate> m_cached_environment_coordinate;
};