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

Issue 2685683002: [async-await] (simpler) fix for Return in try/finally in async functions (Closed)

Created:
3 years, 10 months ago by caitp
Modified:
3 years, 10 months ago
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[async-await] (simpler) fix for Return in try/finally in async functions Alternative approach to https://codereview.chromium.org/2667983004/, which does not depend on implicit control flow changes from https://codereview.chromium.org/2664083002 - Remove handling for `async function` from Parser::RewriteReturn(). This functionality is moved to BytecodeGenerator::BuildAsyncReturn(). This ensures that promise resolution is deferred until all finally blocks are evaluated fully. - Add a new deferred command (CMD_ASYNC_RETURN), which instructs ControlScope to generate return code using BuildAsyncReturn rather than BuildReturn. - Parser has a new `NewReturnStatement()` helper which determines what type of return statement to generate based on the type of function. BUG=v8:5896, v8:4483 R=littledan@chromium.org, neis@chromium.org, rmcilroy@chromium.org, adamk@chromium.org, gsathya@chromium.org Review-Url: https://codereview.chromium.org/2685683002 Cr-Commit-Position: refs/heads/master@{#43104} Committed: https://chromium.googlesource.com/v8/v8/+/39642fa2bef2ca151af32fa0f5bfbf357e8914aa

Patch Set 1 #

Total comments: 4

Patch Set 2 : add some comments + cleanup using BuildHardReturn #

Total comments: 9

Patch Set 3 : Make a new deferred command type, instead of overloading BuildReturn. #

Patch Set 4 : remove comment #

Total comments: 2

Patch Set 5 : [async-await] (simpler) fix for Return in try/finally in async functions #

Total comments: 15

Patch Set 6 : rename ParserBase::NewReturnStatement to ParserBase::BuildReturnStatement() #

Patch Set 7 : add a "RareData" thing to shrink memory use #

Total comments: 1

Patch Set 8 : -Wunused-variable again D: #

Patch Set 9 : also shrink the bitfield for ReturnStatement::Type #

Unified diffs Side-by-side diffs Delta from patch set Stats (+373 lines, -38 lines) Patch
M src/ast/ast.h View 1 2 3 4 5 6 7 8 2 chunks +17 lines, -3 lines 0 comments Download
M src/ast/ast-numbering.cc View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M src/ast/scopes.h View 1 2 3 4 5 6 4 chunks +64 lines, -4 lines 0 comments Download
M src/ast/scopes.cc View 1 2 3 4 5 6 4 chunks +22 lines, -5 lines 0 comments Download
M src/interpreter/bytecode-generator.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/interpreter/bytecode-generator.cc View 1 2 3 4 8 chunks +43 lines, -2 lines 0 comments Download
M src/parsing/parser.cc View 1 2 3 4 5 6 7 3 chunks +4 lines, -7 lines 0 comments Download
M src/parsing/parser-base.h View 1 2 3 4 5 4 chunks +14 lines, -17 lines 0 comments Download
M src/parsing/preparser.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
A test/mjsunit/es8/async-function-try-finally.js View 1 2 3 4 5 1 chunk +201 lines, -0 lines 0 comments Download

Messages

Total messages: 72 (30 generated)
caitp
here's a version which doesn't move the implicit flow control to BCG. The implicit flow-control ...
3 years, 10 months ago (2017-02-07 19:26:56 UTC) #3
rmcilroy
Interpreter parts LGTM with a couple of nits. Thanks. https://codereview.chromium.org/2685683002/diff/1/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2685683002/diff/1/src/interpreter/bytecode-generator.cc#newcode709 src/interpreter/bytecode-generator.cc:709: ...
3 years, 10 months ago (2017-02-08 12:21:57 UTC) #6
caitp
Alright, if people aren't too uncomfortable with the hack in the ReturnStatement AST node, this ...
3 years, 10 months ago (2017-02-08 13:42:58 UTC) #9
Dan Ehrenberg
Hey, I like where this patch is going--it does seem cleaner to put those variables ...
3 years, 10 months ago (2017-02-08 21:12:56 UTC) #12
caitp
On 2017/02/08 21:12:56, Dan Ehrenberg wrote: > Hey, I like where this patch is going--it ...
3 years, 10 months ago (2017-02-08 21:43:27 UTC) #13
Dan Ehrenberg
On 2017/02/08 21:43:27, caitp wrote: > On 2017/02/08 21:12:56, Dan Ehrenberg wrote: > > Hey, ...
3 years, 10 months ago (2017-02-08 22:53:50 UTC) #14
caitp
https://codereview.chromium.org/2685683002/diff/20001/src/ast/ast.h File src/ast/ast.h (right): https://codereview.chromium.org/2685683002/diff/20001/src/ast/ast.h#newcode899 src/ast/ast.h:899: enum Type { kNormal, kHardReturn }; On 2017/02/08 21:12:56, ...
3 years, 10 months ago (2017-02-08 23:22:15 UTC) #15
Dan Ehrenberg
https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc#newcode713 src/interpreter/bytecode-generator.cc:713: BuildHardReturn(); Why is this a hard return? I would ...
3 years, 10 months ago (2017-02-09 06:40:00 UTC) #16
Dan Ehrenberg
https://codereview.chromium.org/2685683002/diff/20001/src/ast/ast.h File src/ast/ast.h (right): https://codereview.chromium.org/2685683002/diff/20001/src/ast/ast.h#newcode899 src/ast/ast.h:899: enum Type { kNormal, kHardReturn }; On 2017/02/08 23:22:15, ...
3 years, 10 months ago (2017-02-09 06:46:58 UTC) #17
caitp
On 2017/02/09 06:46:58, Dan Ehrenberg wrote: > https://codereview.chromium.org/2685683002/diff/20001/src/ast/ast.h > File src/ast/ast.h (right): > > https://codereview.chromium.org/2685683002/diff/20001/src/ast/ast.h#newcode899 ...
3 years, 10 months ago (2017-02-09 12:49:42 UTC) #18
caitp
https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc#newcode713 src/interpreter/bytecode-generator.cc:713: BuildHardReturn(); On 2017/02/09 06:40:00, Dan Ehrenberg wrote: > Why ...
3 years, 10 months ago (2017-02-09 12:53:08 UTC) #19
Dan Ehrenberg
On 2017/02/09 12:49:42, caitp wrote: > On 2017/02/09 06:46:58, Dan Ehrenberg wrote: > > https://codereview.chromium.org/2685683002/diff/20001/src/ast/ast.h ...
3 years, 10 months ago (2017-02-09 13:23:22 UTC) #20
Dan Ehrenberg
https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc#newcode713 src/interpreter/bytecode-generator.cc:713: BuildHardReturn(); On 2017/02/09 12:53:07, caitp wrote: > On 2017/02/09 ...
3 years, 10 months ago (2017-02-09 13:23:36 UTC) #21
rmcilroy
https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc#newcode713 src/interpreter/bytecode-generator.cc:713: BuildHardReturn(); On 2017/02/09 13:23:36, Dan Ehrenberg wrote: > On ...
3 years, 10 months ago (2017-02-09 13:33:49 UTC) #22
caitp
https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc#newcode713 src/interpreter/bytecode-generator.cc:713: BuildHardReturn(); On 2017/02/09 13:33:49, rmcilroy wrote: > On 2017/02/09 ...
3 years, 10 months ago (2017-02-09 13:38:47 UTC) #23
caitp
On 2017/02/09 13:23:22, Dan Ehrenberg wrote: > On 2017/02/09 12:49:42, caitp wrote: > > On ...
3 years, 10 months ago (2017-02-09 14:06:39 UTC) #24
rmcilroy
On 2017/02/09 13:38:47, caitp wrote: > https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc > File src/interpreter/bytecode-generator.cc (right): > > https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc#newcode713 > ...
3 years, 10 months ago (2017-02-09 14:47:38 UTC) #26
caitp
On 2017/02/09 14:47:38, rmcilroy wrote: > On 2017/02/09 13:38:47, caitp wrote: > > > https://codereview.chromium.org/2685683002/diff/20001/src/interpreter/bytecode-generator.cc ...
3 years, 10 months ago (2017-02-09 14:50:44 UTC) #27
caitp
On 2017/02/09 14:50:44, caitp wrote: > On 2017/02/09 14:47:38, rmcilroy wrote: > > On 2017/02/09 ...
3 years, 10 months ago (2017-02-09 14:51:15 UTC) #28
rmcilroy
On 2017/02/09 14:51:15, caitp wrote: > On 2017/02/09 14:50:44, caitp wrote: > > On 2017/02/09 ...
3 years, 10 months ago (2017-02-09 14:58:12 UTC) #29
caitp
On 2017/02/09 14:58:12, rmcilroy wrote: > On 2017/02/09 14:51:15, caitp wrote: > > On 2017/02/09 ...
3 years, 10 months ago (2017-02-09 14:59:37 UTC) #30
rmcilroy
On 2017/02/09 14:59:37, caitp wrote: > On 2017/02/09 14:58:12, rmcilroy wrote: > > On 2017/02/09 ...
3 years, 10 months ago (2017-02-09 15:01:57 UTC) #31
Dan Ehrenberg
On 2017/02/09 14:06:39, caitp wrote: > On 2017/02/09 13:23:22, Dan Ehrenberg wrote: > > On ...
3 years, 10 months ago (2017-02-09 15:12:11 UTC) #32
caitp
So given that we're on the same page with that (reusing the ControlScope machinery rather ...
3 years, 10 months ago (2017-02-09 16:24:42 UTC) #33
rmcilroy
On 2017/02/09 16:24:42, caitp wrote: > So given that we're on the same page with ...
3 years, 10 months ago (2017-02-09 18:27:59 UTC) #34
rmcilroy
On 2017/02/09 16:24:42, caitp wrote: > So given that we're on the same page with ...
3 years, 10 months ago (2017-02-09 18:28:02 UTC) #35
caitp
On 2017/02/09 18:28:02, rmcilroy wrote: > On 2017/02/09 16:24:42, caitp wrote: > > So given ...
3 years, 10 months ago (2017-02-09 19:10:04 UTC) #41
rmcilroy
Interpreter/ LGTM, thanks. https://codereview.chromium.org/2685683002/diff/60001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2685683002/diff/60001/src/interpreter/bytecode-generator.cc#newcode1080 src/interpreter/bytecode-generator.cc:1080: execution_control()->ReturnAccumulator(); nit - could you make ...
3 years, 10 months ago (2017-02-09 23:31:45 UTC) #44
caitp
Just need to hear some sign-off for changes to parsing/ast. https://codereview.chromium.org/2685683002/diff/60001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2685683002/diff/60001/src/interpreter/bytecode-generator.cc#newcode1080 ...
3 years, 10 months ago (2017-02-10 01:20:01 UTC) #45
Dan Ehrenberg
lgtm I really like this version. Before submitting, could you get a review from gsathya ...
3 years, 10 months ago (2017-02-10 07:51:31 UTC) #47
caitp
https://codereview.chromium.org/2685683002/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2685683002/diff/80001/src/parsing/parser-base.h#newcode4276 src/parsing/parser-base.h:4276: zone()); On 2017/02/10 07:51:31, Dan Ehrenberg wrote: > Nit: ...
3 years, 10 months ago (2017-02-10 08:05:07 UTC) #48
caitp
https://codereview.chromium.org/2685683002/diff/80001/test/mjsunit/es8/async-function-try-finally.js File test/mjsunit/es8/async-function-try-finally.js (right): https://codereview.chromium.org/2685683002/diff/80001/test/mjsunit/es8/async-function-try-finally.js#newcode1 test/mjsunit/es8/async-function-try-finally.js:1: // Copyright 2017 the V8 project authors. All rights ...
3 years, 10 months ago (2017-02-10 08:06:34 UTC) #49
marja
Hmm, why doesn't this need changes in fullcodegen? https://codereview.chromium.org/2685683002/diff/80001/src/ast/ast.h File src/ast/ast.h (right): https://codereview.chromium.org/2685683002/diff/80001/src/ast/ast.h#newcode918 src/ast/ast.h:918: : ...
3 years, 10 months ago (2017-02-10 08:16:59 UTC) #52
caitp
https://codereview.chromium.org/2685683002/diff/80001/src/ast/scopes.h File src/ast/scopes.h (right): https://codereview.chromium.org/2685683002/diff/80001/src/ast/scopes.h#newcode897 src/ast/scopes.h:897: Variable* promise_; On 2017/02/10 08:16:59, marja wrote: > Adding ...
3 years, 10 months ago (2017-02-10 08:20:38 UTC) #54
marja
https://codereview.chromium.org/2685683002/diff/80001/src/ast/scopes.h File src/ast/scopes.h (right): https://codereview.chromium.org/2685683002/diff/80001/src/ast/scopes.h#newcode897 src/ast/scopes.h:897: Variable* promise_; On 2017/02/10 08:20:38, caitp wrote: > On ...
3 years, 10 months ago (2017-02-10 08:24:15 UTC) #55
caitp
https://codereview.chromium.org/2685683002/diff/120001/src/ast/scopes.h File src/ast/scopes.h (right): https://codereview.chromium.org/2685683002/diff/120001/src/ast/scopes.h#newcode895 src/ast/scopes.h:895: void* operator new(size_t size, Zone* zone) { return zone->New(size); ...
3 years, 10 months ago (2017-02-10 09:38:24 UTC) #60
caitp
The reason no changes are needed in full-codegen is the "async return" thing is never ...
3 years, 10 months ago (2017-02-10 10:04:59 UTC) #63
marja
lgtm Scope size regressions won't show up in (speed) benchmarks but Scope size has historically ...
3 years, 10 months ago (2017-02-10 13:36:18 UTC) #64
marja
Ah, wanted to clarify that parser/* and ast/* LGTM
3 years, 10 months ago (2017-02-10 13:36:40 UTC) #65
caitp
On 2017/02/10 13:36:40, marja wrote: > Ah, wanted to clarify that parser/* and ast/* LGTM ...
3 years, 10 months ago (2017-02-10 14:13:03 UTC) #66
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2685683002/160001
3 years, 10 months ago (2017-02-10 14:13:20 UTC) #69
commit-bot: I haz the power
3 years, 10 months ago (2017-02-10 14:39:06 UTC) #72
Message was sent while issue was closed.
Committed patchset #9 (id:160001) as
https://chromium.googlesource.com/v8/v8/+/39642fa2bef2ca151af32fa0f5bfbf357e8...

Powered by Google App Engine
This is Rietveld 408576698