New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JSC] ForStatement should call CreatePerIterationEnvironment before first iteration #19403
Merged
webkit-commit-queue
merged 1 commit into
WebKit:main
from
shvaikalesh:eng/JSC-ForStatement-should-call-CreatePerIterationEnvironment-before-first-iteration
Oct 23, 2023
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shvaikalesh
added
the
JavaScriptCore
For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.
label
Oct 22, 2023
EWS run on previous version of this PR (hash 1b96738) |
shvaikalesh
force-pushed
the
eng/JSC-ForStatement-should-call-CreatePerIterationEnvironment-before-first-iteration
branch
from
October 22, 2023 23:08
1b96738
to
7d06af9
Compare
EWS run on current version of this PR (hash 7d06af9) |
justinmichaud
approved these changes
Oct 22, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
shvaikalesh
added
the
unsafe-merge-queue
Applied to send a pull request to merge-queue, but skip building and testing
label
Oct 23, 2023
β¦irst iteration https://bugs.webkit.org/show_bug.cgi?id=189799 <rdar://problem/44730906> Reviewed by Justin Michaud. This change implements step 2 of ForBodyEvaluation [1], but only if loop initializer contains a function that captures a variable from outer scope (so-called closure), to preserve performance of the common case. Emitting prepareLexicalScopeForNextForLoopIteration() unconditionally would otherwise slow down any `for` loop with body statement containing a closure (which is a quite common) by 10-20%. Before this patch, a closure inside `for` loop initializer was created with parent scope of the first iteration, rather than a separate lexical scope, ending up capturing incorrect loop counter value. Aligns JSC with V8 and SpiderMonkey. [1]: https://tc39.es/ecma262/#sec-forbodyevaluation * JSTests/stress/regress-189799.js: Added. * JSTests/test262/expectations.yaml: Mark 2 tests as passing. * Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp: (JSC::ForNode::emitBytecode): * Source/JavaScriptCore/parser/ASTBuilder.h: (JSC::ASTBuilder::createForLoop): * Source/JavaScriptCore/parser/NodeConstructors.h: (JSC::ForNode::ForNode): * Source/JavaScriptCore/parser/Nodes.h: * Source/JavaScriptCore/parser/Parser.cpp: (JSC::Parser<LexerType>::parseForStatement): * Source/JavaScriptCore/parser/SyntaxChecker.h: (JSC::SyntaxChecker::createForLoop): Canonical link: https://commits.webkit.org/269653@main
webkit-commit-queue
force-pushed
the
eng/JSC-ForStatement-should-call-CreatePerIterationEnvironment-before-first-iteration
branch
from
October 23, 2023 17:32
7d06af9
to
f32cd0f
Compare
Committed 269653@main (f32cd0f): https://commits.webkit.org/269653@main Reviewed commits have been landed. Closing PR #19403 and removing active labels. |
webkit-commit-queue
removed
the
unsafe-merge-queue
Applied to send a pull request to merge-queue, but skip building and testing
label
Oct 23, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
JavaScriptCore
For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
f32cd0f
7d06af9