-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[JSC] Implement array-from-async #6937
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] Implement array-from-async #6937
Conversation
f46443c to
100a843
Compare
|
EWS run on previous version of this PR (hash 100a843) Details |
|
EWS run on previous version of this PR (hash f46443c) Details |
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.
This isn't actually necessary as the length of JSBuiltin functions is deducted from their signature. Covered by test262.
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.
Yes, but anyway, I just fixed it since it is wrong :)
100a843 to
caf7d4c
Compare
|
EWS run on previous version of this PR (hash caf7d4c) Details |
caf7d4c to
9c02c78
Compare
|
EWS run on previous version of this PR (hash 9c02c78) Details |
9c02c78 to
854b742
Compare
|
EWS run on current version of this PR (hash 854b742) Details |
854b742 to
8329ff0
Compare
https://bugs.webkit.org/show_bug.cgi?id=245260 rdar://problem/100303653 Reviewed by Alexey Shvayka. This patch implements stage-3 Array.fromAsync[1] feature. The goal of this feature is providing async iteration version of Array.from. Array.from's concept. const arr = []; for (const v of iterable) { arr.push(v); } Array.fromAsync's concept. const arr = []; for await (const v of asyncIterable) { arr.push(v); } The complicated part of this change is that, when using `async function` in builtin JS, it automatically generates internal promise, which we would like to avoid here. In the future, we would like to remove internal promise completely, but for now, we workaround this restriction by the convention that, when the builtin JS function's name starts with `defaultAsync`, then we use normal promise instead of internal promise. [1]: https://github.com/tc39/proposal-array-from-async * JSTests/stress/array-from-async-basic.js: Added. (shouldBe): (shouldBeArray): (async test.async shouldBeArray): (async test): (test.catch): * JSTests/stress/array-from-async-map-promise.js: Added. (shouldBe): (shouldBeArray): (async test.): (async test.async shouldBeArray): (async test): (test.catch): * JSTests/stress/array-from-async-map-this.js: Added. (shouldBe): (shouldBeArray): (async test.): (async test.async shouldBeArray): (async test): (test.catch): * JSTests/stress/array-from-async-map.js: Added. (shouldBe): (shouldBeArray): (async test.): (async test.async shouldBeArray): (async test): (test.catch): * Source/JavaScriptCore/builtins/ArrayConstructor.js: (from.wrapper.iterator): (from): (wrapper.asyncIterator): (linkTimeConstant.async defaultAsyncFromAsyncIterator): (linkTimeConstant.async defaultAsyncFromAsyncArrayLike): (fromAsync): * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): * Source/JavaScriptCore/runtime/ArrayConstructor.cpp: (JSC::ArrayConstructor::finishCreation): * Source/JavaScriptCore/runtime/OptionsList.h: Canonical link: https://commits.webkit.org/257177@main
8329ff0 to
464a308
Compare
|
Committed 257177@main (464a308): https://commits.webkit.org/257177@main Reviewed commits have been landed. Closing PR #6937 and removing active labels. |
464a308
854b742
🧪 style🛠 ios🛠 mac🛠 wpe🛠 🧪 win🛠 ios-sim🛠 mac-debug🛠 gtk🛠 wincairo🧪 webkitperl🛠 mac-AS-debug🧪 api-gtk🛠 🧪 jsc🛠 tv🧪 mac-wk1🛠 jsc-armv7🛠 tv-sim🛠 watch🧪 mac-AS-debug-wk2🛠 jsc-mips🛠 watch-sim