[webkit-changes] [WebKit/WebKit] 5fc313: [JSC] Avoid saving top-level scope for non-module ...
Tadeu Zagallo
noreply at github.com
Thu Feb 23 06:25:41 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5fc313f94632beae308222510df47f48b9e6b866
https://github.com/WebKit/WebKit/commit/5fc313f94632beae308222510df47f48b9e6b866
Author: Tadeu Zagallo <tzagallo at apple.com>
Date: 2023-02-23 (Thu, 23 Feb 2023)
Changed paths:
M JSTests/stress/call-link-info-osrexit-repatch.js
A JSTests/stress/hoisted-eval-different-scope.js
M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
Log Message:
-----------
[JSC] Avoid saving top-level scope for non-module code
https://bugs.webkit.org/show_bug.cgi?id=252674
rdar://105732218
Reviewed by Yusuke Suzuki.
Avoid allocating a local variable and moving the scope to save the top-level
scope. Re-loading the context is pretty cheap and this reduces the amount of
bytecode overhead for small functions. Notice that we still allocate a variable
for module code, which is necessary since we allocate a lexical environment,
which needs the scope for variable resolution.
* JSTests/stress/hoisted-eval-different-scope.js: Added.
(i.with.g):
(i.g.f):
(i.g):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitResolveScopeForHoistingFuncDeclInEval):
(JSC::BytecodeGenerator::allocateAndEmitScope):
(JSC::BytecodeGenerator::restoreScopeRegister):
Canonical link: https://commits.webkit.org/260743@main
More information about the webkit-changes
mailing list