Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Issue 2672313003: [async await] fix async await desugaring

Created:
3 years, 10 months ago by gsathya
Modified:
3 years, 10 months ago
Reviewers:
caitp, neis
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[async await] Fix async function desugaring Previously we rewrote the return statement in an async function from `return expr;` to `return %ResolvePromise(.promise, expr), .promise`. This can lead to incorrect behavior in the presence of try-finally. This patch stores the `expr` of the return statement in a temporary variable, resolves and returns the promise at the end of the finally block. BUG=v8:5896

Patch Set 1 #

Patch Set 2 : rename var #

Patch Set 3 : fixes #

Patch Set 4 : refactor #

Total comments: 33

Patch Set 5 : fixes #

Patch Set 6 : increase capacity #

Patch Set 7 : separate the functions #

Patch Set 8 : fmt #

Unified diffs Side-by-side diffs Delta from patch set Stats (+201 lines, -45 lines) Patch
M src/parsing/parser.h View 1 2 3 4 5 6 3 chunks +5 lines, -3 lines 0 comments Download
M src/parsing/parser.cc View 1 2 3 4 5 6 7 6 chunks +158 lines, -40 lines 0 comments Download
M src/parsing/parser-base.h View 1 2 3 4 5 chunks +16 lines, -2 lines 0 comments Download
M src/parsing/preparser.h View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
A test/mjsunit/regress/regress-5896.js View 1 2 3 1 chunk +17 lines, -0 lines 0 comments Download

Messages

Total messages: 31 (24 generated)
gsathya
3 years, 10 months ago (2017-02-07 19:30:53 UTC) #7
adamk
This approach looks to me like it should work; would like both caitp and neis ...
3 years, 10 months ago (2017-02-07 21:42:01 UTC) #10
caitp
LGTM. I think i can live with this approach, if it's the way we want ...
3 years, 10 months ago (2017-02-07 23:47:17 UTC) #11
neis
https://codereview.chromium.org/2672313003/diff/60001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2672313003/diff/60001/src/parsing/parser-base.h#newcode450 src/parsing/parser-base.h:450: DCHECK(variable != NULL); DCHECK_NOT_NULL https://codereview.chromium.org/2672313003/diff/60001/src/parsing/parser.cc File src/parsing/parser.cc (right): https://codereview.chromium.org/2672313003/diff/60001/src/parsing/parser.cc#newcode1622 ...
3 years, 10 months ago (2017-02-08 10:28:41 UTC) #12
neis
From the description: "This breaks when there is a return statement in a finally block ...
3 years, 10 months ago (2017-02-08 10:33:25 UTC) #13
gsathya
https://codereview.chromium.org/2672313003/diff/60001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2672313003/diff/60001/src/parsing/parser-base.h#newcode450 src/parsing/parser-base.h:450: DCHECK(variable != NULL); On 2017/02/08 10:28:41, neis wrote: > ...
3 years, 10 months ago (2017-02-09 00:55:45 UTC) #27
neis
3 years, 10 months ago (2017-02-09 08:22:08 UTC) #30
lgtm

https://codereview.chromium.org/2672313003/diff/60001/src/parsing/parser.cc
File src/parsing/parser.cc (right):

https://codereview.chromium.org/2672313003/diff/60001/src/parsing/parser.cc#n...
src/parsing/parser.cc:3124: kNoSourcePosition);
On 2017/02/09 00:55:44, gsathya wrote:
> On 2017/02/08 10:28:41, neis wrote:
> > No need for a comparison here.
> 
> Why not? We need to return only in the case of rejection, is there a better
way
> to do this?
> 
> Note -- this isn't required any more with the change caitp@ mentioned.

I meant you can just do "if (is_rejection_var) ..." instead of "if
(is_rejection_var == true) ..."

Powered by Google App Engine
This is Rietveld 408576698