-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Normative: Lookup constructor.resolve only once in PerformPromise{All, Race} #1506
Conversation
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.
The proposed spec text seems correct.
Early throwing also matches Map etc, which check before iteration. (They do |
SGTM, I hear folks like consistency. PR updated. |
In the PerformPromise{All, Race, AllSettled} operations, the resolve property of the constructor is looked up only once. In the implementation, for the fast path, where the constructor's resolve property is untainted, the resolve function is set to undefined. Since undefined can't be a valid value for the resolve function, we can switch on it (in CallResolve) to directly call the PromiseResolve builtin. If the resolve property is tainted, we do an observable property lookup, save this value, and call this property later (in CallResolve). I ran this CL against the test262 tests locally and they all pass: tc39/test262#2131 Spec: - tc39/ecma262#1506 - tc39/proposal-promise-allSettled#40 Bug: v8:9152 Change-Id: Icb36a90b5a244a67a729611c7b3315d2c29de6e9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1574705 Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#60957}
This has reached consensus at the TC39 meeting today. |
295858d
to
25745fe
Compare
https://bugs.webkit.org/show_bug.cgi?id=198864 Patch by Alexey Shvayka <shvaikalesh@gmail.com> on 2019-06-19 Reviewed by Yusuke Suzuki. JSTests: * test262/expectations.yaml: Mark 18 test cases as passing. Source/JavaScriptCore: Lookup `resolve` method only once in Promise.{all,allSettled,race}. (tc39/ecma262#1506) Already implemented in V8. * builtins/PromiseConstructor.js: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@246620 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=198864 Patch by Alexey Shvayka <shvaikalesh@gmail.com> on 2019-06-19 Reviewed by Yusuke Suzuki. JSTests: * test262/expectations.yaml: Mark 18 test cases as passing. Source/JavaScriptCore: Lookup `resolve` method only once in Promise.{all,allSettled,race}. (tc39/ecma262#1506) Already implemented in V8. * builtins/PromiseConstructor.js: Canonical link: https://commits.webkit.org/213010@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246620 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fixes #1505