summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/AST.h
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-10-07 20:13:22 +0330
committerAndreas Kling <kling@serenityos.org>2021-10-08 12:25:24 +0200
commit12b283f32fe177bf3acafb2d688a75180da4bac7 (patch)
tree8e99257411aa9a4574b944030802c1869e8e6e93 /Userland/Libraries/LibJS/AST.h
parentda296ffd56a6ea0967eef1a54d2c7c81bd1043c2 (diff)
downloadserenity-12b283f32fe177bf3acafb2d688a75180da4bac7.zip
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.
Diffstat (limited to 'Userland/Libraries/LibJS/AST.h')
-rw-r--r--Userland/Libraries/LibJS/AST.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/AST.h b/Userland/Libraries/LibJS/AST.h
index 3952c5a8db..27a1797871 100644
--- a/Userland/Libraries/LibJS/AST.h
+++ b/Userland/Libraries/LibJS/AST.h
@@ -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;
};