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

Issue 2664083002: [ignition] desugar async functions/generators/modules in BytecodeGenerator

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

Description

[ignition] desugar async functions/generators/modules in BytecodeGenerator Implements the "port-desugaring-to-Ignition" aspects of https://codereview.chromium.org/2654423004/ without fixing the actual bug, and leaving much of the AST desugaring (particularly the desugaring of ReturnStatement and AwaitExpression) alone. This should create a way to fix the actual bug with a much smaller change. The `DeclareGeneratorObjectVar` and `DeclarePromiseVar` methods are added to Scope to make these variables accessible to the BytecodeGenerator. They will be removed once the Parser no longer implements the desugaring of Await, Yield*, and function.sent. This includes the changes of moving the assignment of a named FunctionExpression's variable to BytecodeGenerator, and additionally separating the AST desugaring of non-simple parameters, to allow BytecodeGenerator to control how and when they are visited (necessary for putting them inside of a generated try/catch/finally block, as the case may be). Finally, some helpers are added to the BytecodeGenerator to allow the generation of Yield code, and try/catch/finally code without AST desugaring. BUG=v8:4280 R=neis@chromium.org, rmcilroy@chromium.org, littledan@chromium.org

Patch Set 1 #

Patch Set 2 : -Wunused-variable .v. #

Patch Set 3 : remove some declarations for deleted Parser methods, too #

Patch Set 4 : clean merge #

Patch Set 5 : make it a little easier to read #

Total comments: 20

Patch Set 6 : get rid of lambdas, for better or worse.. #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+1351 lines, -595 lines) Patch
M src/ast/ast.h View 1 2 3 4 3 chunks +8 lines, -0 lines 0 comments Download
M src/ast/ast-expression-rewriter.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M src/ast/ast-numbering.cc View 1 2 3 4 1 chunk +27 lines, -0 lines 0 comments Download
M src/ast/scopes.h View 1 2 3 4 5 chunks +24 lines, -1 line 0 comments Download
M src/ast/scopes.cc View 1 2 3 4 3 chunks +30 lines, -0 lines 0 comments Download
M src/bailout-reason.h View 1 chunk +2 lines, -1 line 0 comments Download
M src/full-codegen/full-codegen.cc View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/interpreter/bytecode-array-builder.h View 1 2 3 4 1 chunk +7 lines, -3 lines 0 comments Download
M src/interpreter/bytecode-generator.h View 1 2 3 4 5 3 chunks +27 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-generator.cc View 1 2 3 4 5 11 chunks +478 lines, -90 lines 4 comments Download
M src/interpreter/control-flow-builders.h View 1 2 3 4 5 3 chunks +7 lines, -3 lines 0 comments Download
M src/parsing/parser.h View 1 2 3 4 5 chunks +6 lines, -22 lines 0 comments Download
M src/parsing/parser.cc View 1 2 3 4 11 chunks +30 lines, -164 lines 0 comments Download
M src/parsing/parser-base.h View 1 2 3 4 11 chunks +22 lines, -51 lines 0 comments Download
M src/parsing/preparser.h View 1 2 3 4 7 chunks +7 lines, -15 lines 0 comments Download
M src/parsing/preparser.cc View 1 2 3 4 1 chunk +3 lines, -2 lines 0 comments Download
A test/cctest/interpreter/bytecode_expectations/AsyncFunctions.golden View 1 2 3 4 5 1 chunk +479 lines, -0 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/Generators.golden View 1 2 3 4 22 chunks +85 lines, -102 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/Modules.golden View 1 2 3 4 35 chunks +83 lines, -138 lines 0 comments Download
M test/cctest/interpreter/bytecode_expectations/ThisFunction.golden View 1 chunk +2 lines, -3 lines 0 comments Download
M test/cctest/interpreter/test-bytecode-generator.cc View 1 2 3 4 5 1 chunk +21 lines, -0 lines 0 comments Download

Messages

Total messages: 32 (18 generated)
caitp
H'okay. This splits out the "port to Ignition" side of https://codereview.chromium.org/2654423004/. Hopefully this is easier ...
3 years, 10 months ago (2017-01-31 02:41:24 UTC) #7
rmcilroy
On 2017/01/31 02:41:24, caitp wrote: > H'okay. > > This splits out the "port to ...
3 years, 10 months ago (2017-01-31 21:05:26 UTC) #12
caitp
On 2017/01/31 21:05:26, rmcilroy (travelling till 3rd) wrote: > On 2017/01/31 02:41:24, caitp wrote: > ...
3 years, 10 months ago (2017-01-31 21:27:35 UTC) #13
rmcilroy
On 2017/01/31 21:27:35, caitp wrote: > On 2017/01/31 21:05:26, rmcilroy (travelling till 3rd) wrote: > ...
3 years, 10 months ago (2017-02-02 00:10:48 UTC) #14
caitp
On 2017/02/02 00:10:48, rmcilroy (travelling till 3rd) wrote: > On 2017/01/31 21:27:35, caitp wrote: > ...
3 years, 10 months ago (2017-02-02 00:51:00 UTC) #15
caitp
So, from the comment on the proposal document, it sounds like you can live with ...
3 years, 10 months ago (2017-02-06 19:15:10 UTC) #16
caitp
On 2017/02/06 19:15:10, caitp wrote: > So, from the comment on the proposal document, it ...
3 years, 10 months ago (2017-02-06 21:17:15 UTC) #19
rmcilroy
Some higher level comments. https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecode-generator.cc#newcode745 src/interpreter/bytecode-generator.cc:745: } This change doesn't seem ...
3 years, 10 months ago (2017-02-06 22:27:50 UTC) #22
caitp
I'll see what I can do about these requests. Answered some questions inline https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecode-generator.cc File ...
3 years, 10 months ago (2017-02-06 22:48:25 UTC) #23
caitp
https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecode-generator.cc#newcode771 src/interpreter/bytecode-generator.cc:771: int yield_position = info()->literal()->position(); On 2017/02/06 22:48:23, caitp wrote: ...
3 years, 10 months ago (2017-02-06 23:29:36 UTC) #24
caitp
On 2017/02/06 23:29:36, caitp wrote: > https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecode-generator.cc > File src/interpreter/bytecode-generator.cc (right): > > https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecode-generator.cc#newcode771 > ...
3 years, 10 months ago (2017-02-07 03:49:16 UTC) #25
rmcilroy
https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecode-generator.cc#newcode745 src/interpreter/bytecode-generator.cc:745: } On 2017/02/06 22:48:23, caitp wrote: > On 2017/02/06 ...
3 years, 10 months ago (2017-02-07 17:24:42 UTC) #30
caitp
Thanks for the look --- as noted inline, I think I'm going to take a ...
3 years, 10 months ago (2017-02-07 18:13:08 UTC) #31
rmcilroy
3 years, 10 months ago (2017-02-07 20:48:33 UTC) #32
On 2017/02/07 18:13:08, caitp wrote:
> Thanks for the look --- as noted inline, I think I'm going to take a break
from
> this particular CL for a while (or at least not be able to land it upstream
for
> a while), due to not wanting to force more code that was previously on the
> FCG/CS pipeline onto ignition (particularly named FunctionExpressions)
> 
>
https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecod...
> File src/interpreter/bytecode-generator.cc (right):
> 
>
https://codereview.chromium.org/2664083002/diff/80001/src/interpreter/bytecod...
> src/interpreter/bytecode-generator.cc:745: }
> On 2017/02/07 17:24:41, rmcilroy wrote:
> > On 2017/02/06 22:48:23, caitp wrote:
> > > On 2017/02/06 22:27:50, rmcilroy wrote:
> > > > This change doesn't seem related to the generator / resumable change,
> could
> > it
> > > > be made in another CL?
> > > 
> > > well, I would love to do it in a separate CL, but there's a reason it's
> here:
> > > 
> > > My reasoning is as follows:
> > > 
> > > 1) In order to do the implicit control-flow magic in BytecodeGenerator,
> > > BytecodeGenerator (and thus the FunctionLiteral AST) need knowledge of
stuff
> > > that gets added implicitly to function bodies by the Parser. In
particular,
> > > parameter initialization needs to happen within the implicit try-block in
> > async
> > > functions, so that any errors during initialization are propagated to
> > > RejectPromise().
> > > 
> > > 2) It's possible (and there are tests verifying) that the function-named
> > > variable is possible to use during parameter initialization, so needs to
be
> > > bound before parameter initialization.
> > > 
> > > ---
> > > 
> > > So given that, it is unfortunately related. I wouldn't mind submitting it
in
> > > separate patches, but that would require changing test262.status and
> > > mjsunit.status temporarily, and it's a relatively small change to do it
> here.
> > I
> > > think there is a net benefit to this change though, in that it allows
> omitting
> > > allocation/assignment of the function-var when it's guaranteed to not be
> used,
> > > which is probably the vast majority of cases.
> > 
> > OK I can live with this change in this CL, thanks for the explination.
> 
> Actually, I brought this up in the meeting today, and Adam would prefer if I
> didn't prevent common code (named function expressions where the
function-named
> variable is actually used) from using the full-codegen/crankshaft path in this
> release.
> 
> So, if I want to do this, I either need to implement it in FCG/Crankshaft
(which
> shouldn't be too hard, but I suspect nobody wants me to do this), or hold back
> until --turbo is enabled by default.
> 
> For now, I'll try to go with a simpler change. Will open another CL shortly.
> I'll keep this one open in case anyone decides it's okay to make this change
or
> okay to add code handling it in FCG/CS

OK no problem thanks for letting me know. Let me know if / when you want to
start looking at this CL again.

Powered by Google App Engine
This is Rietveld 408576698