Bug 216637

Summary: [JSC] Optimize Promise#finally by avoiding creating multiple environments
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, joepeck, keith_miller, mark.lam, msaboff, ross.kirsling, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Yusuke Suzuki 2020-09-16 23:00:26 PDT
[JSC] Optimize Promise#finally by avoiding creating multiple environments
Comment 1 Yusuke Suzuki 2020-09-16 23:07:21 PDT
Created attachment 408992 [details]
Patch
Comment 2 Ross Kirsling 2020-09-16 23:35:56 PDT
Comment on attachment 408992 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=408992&action=review

Seems fine to me.

> Source/JavaScriptCore/builtins/PromisePrototype.js:74
> +        thenFinally = (0, /* prevent function name inference */ (value) => {

nit: Seems like this could be a line comment above? But I don't feel that strongly.
Comment 3 Yusuke Suzuki 2020-09-16 23:54:29 PDT
Comment on attachment 408992 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=408992&action=review

>> Source/JavaScriptCore/builtins/PromisePrototype.js:74
>> +        thenFinally = (0, /* prevent function name inference */ (value) => {
> 
> nit: Seems like this could be a line comment above? But I don't feel that strongly.

I think this is because `(0, expr)` looks super tricky, and this inlined comment helps readers to understand why this comma expression exists. I think this prefixed comment is nice for consistency since we are using this style in the other places.
Comment 4 EWS 2020-09-17 01:06:05 PDT
Committed r267184: <https://trac.webkit.org/changeset/267184>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408992 [details].
Comment 5 Radar WebKit Bug Importer 2020-09-17 01:07:21 PDT
<rdar://problem/69049394>