From d53a0c4e9f8c4f4b4428e823fca5aca2acc4921c Mon Sep 17 00:00:00 2001 From: Haled Odat <8566042+HalidOdat@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:32:41 +0200 Subject: [PATCH] Don't create parameter expressions environment if not used --- boa_engine/src/bytecompiler/declarations.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/boa_engine/src/bytecompiler/declarations.rs b/boa_engine/src/bytecompiler/declarations.rs index 5cd18ed18c3..747b1296b4f 100644 --- a/boa_engine/src/bytecompiler/declarations.rs +++ b/boa_engine/src/bytecompiler/declarations.rs @@ -932,8 +932,11 @@ impl ByteCompiler<'_, '_> { // c. Let env be NewDeclarativeEnvironment(calleeEnv). // d. Assert: The VariableEnvironment of calleeContext is calleeEnv. // e. Set the LexicalEnvironment of calleeContext to env. - let _ = self.push_compile_environment(false); - additional_env = true; + + if self.can_optimize_local_variables { + let _ = self.push_compile_environment(false); + additional_env = true; + } } // 22. If argumentsObjectNeeded is true, then