Skip to content
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] Create (async) generator object after performing FunctionDeclarationInstantiation #19564

Conversation

shvaikalesh
Copy link
Member

@shvaikalesh shvaikalesh commented Oct 25, 2023

d9e5846

[JSC] Create (async) generator object after performing FunctionDeclarationInstantiation
https://bugs.webkit.org/show_bug.cgi?id=263617
<rdar://problem/117439419>

Reviewed by Justin Michaud.

initializeDefaultParameterValuesAndSetupFunctionScopeStack(), which implements steps 25-26 of
FunctionDeclarationInstantiation [1], may call into arbitrary userland code when evaluating
default parameters, affecting the [[Prototype]] of created & returned (async) generator object.

With this change, (async) generator object creation happens after parameter initialization,
aligning JSC with the spec [1][2] and SpiderMonkey.

[1]: https://tc39.es/ecma262/#sec-functiondeclarationinstantiation
[2]: https://tc39.es/ecma262/#sec-runtime-semantics-evaluategeneratorbody (step 2)
[3]: https://tc39.es/ecma262/#sec-runtime-semantics-evaluateasyncgeneratorbody (step 2)

* JSTests/stress/regress-263617.js: Added.
* JSTests/test262/expectations.yaml: Mark 8 tests as passing.
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):

Canonical link: https://commits.webkit.org/269823@main

bf215af

Misc iOS, tvOS & watchOS macOS Linux Windows
🧪 style 🛠 ios 🛠 mac 🛠 wpe 🛠 wincairo
🛠 ios-sim 🛠 mac-AS-debug 🧪 wpe-wk2
🧪 webkitperl 🧪 ios-wk2 🧪 api-mac 🛠 gtk
🧪 ios-wk2-wpt 🧪 mac-wk1 🧪 gtk-wk2
🛠 🧪 jsc 🧪 api-ios 🧪 mac-wk2 🧪 api-gtk
🛠 🧪 jsc-arm64 🛠 tv 🧪 mac-AS-debug-wk2 🛠 jsc-armv7
🛠 tv-sim 🧪 mac-wk2-stress 🧪 jsc-armv7-tests
🛠 watch 🛠 jsc-mips
✅ 🛠 🧪 unsafe-merge 🛠 watch-sim 🧪 jsc-mips-tests

@shvaikalesh shvaikalesh requested a review from a team as a code owner October 25, 2023 20:58
@shvaikalesh shvaikalesh self-assigned this Oct 25, 2023
@shvaikalesh shvaikalesh added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Oct 25, 2023
@shvaikalesh shvaikalesh force-pushed the eng/JSC-Create-async-generator-object-after-performing-FunctionDeclarationInstantiation branch from 5109c7b to 3c7f1d8 Compare October 25, 2023 21:00
Copy link
Contributor

@justinmichaud justinmichaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

@shvaikalesh shvaikalesh force-pushed the eng/JSC-Create-async-generator-object-after-performing-FunctionDeclarationInstantiation branch from 3c7f1d8 to bf215af Compare October 26, 2023 19:53
@shvaikalesh shvaikalesh added the skip-ews Applied to prevent a change from being run on EWS label Oct 26, 2023
@shvaikalesh shvaikalesh added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing skip-ews Applied to prevent a change from being run on EWS and removed unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing skip-ews Applied to prevent a change from being run on EWS labels Oct 26, 2023
…ationInstantiation

https://bugs.webkit.org/show_bug.cgi?id=263617
<rdar://problem/117439419>

Reviewed by Justin Michaud.

initializeDefaultParameterValuesAndSetupFunctionScopeStack(), which implements steps 25-26 of
FunctionDeclarationInstantiation [1], may call into arbitrary userland code when evaluating
default parameters, affecting the [[Prototype]] of created & returned (async) generator object.

With this change, (async) generator object creation happens after parameter initialization,
aligning JSC with the spec [1][2] and SpiderMonkey.

[1]: https://tc39.es/ecma262/#sec-functiondeclarationinstantiation
[2]: https://tc39.es/ecma262/#sec-runtime-semantics-evaluategeneratorbody (step 2)
[3]: https://tc39.es/ecma262/#sec-runtime-semantics-evaluateasyncgeneratorbody (step 2)

* JSTests/stress/regress-263617.js: Added.
* JSTests/test262/expectations.yaml: Mark 8 tests as passing.
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):

Canonical link: https://commits.webkit.org/269823@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/JSC-Create-async-generator-object-after-performing-FunctionDeclarationInstantiation branch from bf215af to d9e5846 Compare October 26, 2023 20:14
@webkit-commit-queue
Copy link
Collaborator

Committed 269823@main (d9e5846): https://commits.webkit.org/269823@main

Reviewed commits have been landed. Closing PR #19564 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit d9e5846 into WebKit:main Oct 26, 2023
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Oct 26, 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. skip-ews Applied to prevent a change from being run on EWS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants