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

Issue 1272673003: [es6] Re-implement rest parameters via desugaring. (Closed)

Created:
5 years, 4 months ago by caitp (gmail)
Modified:
5 years, 3 months ago
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[es6] Re-implement rest parameters via desugaring. Kills the kRestParameter bailout/disabled optimization, and fixes lazily parsed arrow functions with rest parameters. Supercedes https://crrev.com/1235153006/ BUG=chromium:508074, v8:2160, v8:2700 LOG=N R=rossberg@chromium.org, adamk@chromium.org, wingo@igalia.com Committed: https://crrev.com/510baeacbab311798d5e8795800ff773d00d062c Cr-Commit-Position: refs/heads/master@{#30550}

Patch Set 1 #

Total comments: 5

Patch Set 2 : Fix some style issues #

Patch Set 3 : remove unneeded change #

Patch Set 4 : Rebase + fix brokenness #

Total comments: 32

Patch Set 5 : Remove AST node, refactor stuff, address comments #

Patch Set 6 : Little more cleanup #

Patch Set 7 : Tiny bit more cleanup #

Total comments: 17

Patch Set 8 : Few of Andy's comments addressed #

Patch Set 9 : Use else-if (and rebase, sorry) #

Total comments: 17

Patch Set 10 : Fix comment + remove unneeded changes #

Patch Set 11 : Reduce use of "auto" a bit, remove unneeded changes #

Patch Set 12 : Rebase (ARM full-codegen) #

Patch Set 13 : Oops. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+193 lines, -497 lines) Patch
M src/arm/code-stubs-arm.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -25 lines 0 comments Download
M src/arm64/code-stubs-arm64.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -50 lines 0 comments Download
M src/ast-literal-reindexer.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/ast-value-factory.h View 1 2 3 1 chunk +29 lines, -28 lines 0 comments Download
M src/bailout-reason.h View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M src/code-stubs.h View 1 2 3 4 5 6 7 2 chunks +1 line, -19 lines 0 comments Download
M src/code-stubs.cc View 1 2 3 2 chunks +0 lines, -10 lines 0 comments Download
M src/compiler/ast-graph-builder.h View 1 2 3 4 5 6 7 1 chunk +0 lines, -3 lines 0 comments Download
M src/compiler/ast-graph-builder.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +0 lines, -23 lines 0 comments Download
M src/compiler/linkage.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M src/full-codegen/arm/full-codegen-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -22 lines 0 comments Download
M src/full-codegen/arm64/full-codegen-arm64.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -22 lines 0 comments Download
M src/full-codegen/ia32/full-codegen-ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -23 lines 0 comments Download
M src/full-codegen/mips/full-codegen-mips.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -23 lines 0 comments Download
M src/full-codegen/mips64/full-codegen-mips64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -23 lines 0 comments Download
M src/full-codegen/x64/full-codegen-x64.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -22 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -6 lines 0 comments Download
M src/ia32/code-stubs-ia32.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -26 lines 0 comments Download
M src/mips/code-stubs-mips.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -28 lines 0 comments Download
M src/mips64/code-stubs-mips64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -29 lines 0 comments Download
M src/parser.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +4 lines, -5 lines 2 comments Download
M src/parser.cc View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +90 lines, -7 lines 0 comments Download
M src/preparser.h View 1 2 3 4 5 6 7 8 9 10 8 chunks +35 lines, -3 lines 0 comments Download
M src/runtime/runtime.h View 1 2 3 4 5 6 7 1 chunk +0 lines, -2 lines 0 comments Download
M src/runtime/runtime-scopes.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -48 lines 0 comments Download
M src/x64/code-stubs-x64.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -28 lines 0 comments Download
A + test/mjsunit/harmony/arrow-rest-params-lazy-parsing.js View 1 2 3 4 chunks +5 lines, -4 lines 0 comments Download
A test/mjsunit/harmony/regress/regress-508074.js View 1 chunk +26 lines, -0 lines 0 comments Download
M test/mjsunit/harmony/rest-params.js View 1 2 3 3 chunks +2 lines, -16 lines 0 comments Download

Messages

Total messages: 61 (9 generated)
caitp (gmail)
I could use a bit of help on this, I'm having trouble fixing the arrow ...
5 years, 4 months ago (2015-08-05 20:32:21 UTC) #1
adamk
Looking into the crash locally, but here's some stylistic comments in the meantime. https://codereview.chromium.org/1272673003/diff/1/src/parser.cc File ...
5 years, 4 months ago (2015-08-05 22:13:02 UTC) #2
adamk
After hacking on this for awhile, I think at least part of the problem is ...
5 years, 4 months ago (2015-08-05 23:36:00 UTC) #3
adamk
On 2015/08/05 23:36:00, adamk wrote: > After hacking on this for awhile, I think at ...
5 years, 4 months ago (2015-08-06 00:23:16 UTC) #4
caitp (gmail)
On 2015/08/06 00:23:16, adamk wrote: > On 2015/08/05 23:36:00, adamk wrote: > > After hacking ...
5 years, 4 months ago (2015-08-06 02:09:45 UTC) #5
caitp (gmail)
On 2015/08/06 02:09:45, caitp wrote: > On 2015/08/06 00:23:16, adamk wrote: > > On 2015/08/05 ...
5 years, 4 months ago (2015-08-06 02:15:06 UTC) #6
rossberg
I also tried digging into it, but without much success. Something must be pointing into ...
5 years, 4 months ago (2015-08-06 14:43:53 UTC) #7
caitp (gmail)
On 2015/08/06 14:43:53, rossberg wrote: > I also tried digging into it, but without much ...
5 years, 4 months ago (2015-08-06 15:19:18 UTC) #8
caitp (gmail)
Hey, can folks take another look at this? I need someone to review the new ...
5 years, 3 months ago (2015-08-28 14:09:03 UTC) #9
adamk
I will take a look at this today (sorry I've been slow to respond this ...
5 years, 3 months ago (2015-08-28 15:47:52 UTC) #10
adamk
Excited to see this passing tests! As you suspected, I'm a little bit skeptical of ...
5 years, 3 months ago (2015-08-28 23:26:37 UTC) #11
caitp (gmail)
https://codereview.chromium.org/1272673003/diff/60001/src/ast-expression-visitor.cc File src/ast-expression-visitor.cc (right): https://codereview.chromium.org/1272673003/diff/60001/src/ast-expression-visitor.cc#newcode206 src/ast-expression-visitor.cc:206: void AstExpressionVisitor::VisitRestParameter(RestParameter* expr) { On 2015/08/28 23:26:37, adamk wrote: ...
5 years, 3 months ago (2015-08-28 23:58:01 UTC) #12
adamk
https://codereview.chromium.org/1272673003/diff/60001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1272673003/diff/60001/src/parser.cc#newcode4012 src/parser.cc:4012: for (const auto p : parameters.params) { On 2015/08/28 ...
5 years, 3 months ago (2015-08-29 01:01:07 UTC) #13
caitp (gmail)
I think this addresses all of the comments https://codereview.chromium.org/1272673003/diff/60001/src/ast-expression-visitor.cc File src/ast-expression-visitor.cc (right): https://codereview.chromium.org/1272673003/diff/60001/src/ast-expression-visitor.cc#newcode206 src/ast-expression-visitor.cc:206: void ...
5 years, 3 months ago (2015-08-29 15:52:00 UTC) #14
wingo
https://codereview.chromium.org/1272673003/diff/110001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1272673003/diff/110001/src/parser.cc#newcode3947 src/parser.cc:3947: ReportMessageAt(params_loc, MessageTemplate::kMalformedArrowFunParamList); Why is this necessary? ParseArrowFunctionFormalParameters should only ...
5 years, 3 months ago (2015-08-31 13:07:31 UTC) #15
caitp (gmail)
Thanks Andy, few more cleanup points here =) https://codereview.chromium.org/1272673003/diff/110001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1272673003/diff/110001/src/parser.cc#newcode3947 src/parser.cc:3947: ReportMessageAt(params_loc, ...
5 years, 3 months ago (2015-08-31 13:23:40 UTC) #16
caitp (gmail)
https://codereview.chromium.org/1272673003/diff/110001/src/preparser.h File src/preparser.h (right): https://codereview.chromium.org/1272673003/diff/110001/src/preparser.h#newcode1044 src/preparser.h:1044: (IsBinaryOperation() && HasRestField::decode(code_)); On 2015/08/31 13:23:40, caitp wrote: > ...
5 years, 3 months ago (2015-08-31 13:28:17 UTC) #17
wingo
On 2015/08/31 13:28:17, caitp wrote: > https://codereview.chromium.org/1272673003/diff/110001/src/preparser.h > File src/preparser.h (right): > > https://codereview.chromium.org/1272673003/diff/110001/src/preparser.h#newcode1044 > ...
5 years, 3 months ago (2015-08-31 13:39:49 UTC) #18
wingo
Hi :) On 2015/08/31 13:23:40, caitp wrote: > https://codereview.chromium.org/1272673003/diff/110001/src/parser.cc#newcode4187 > src/parser.cc:4187: } > On 2015/08/31 ...
5 years, 3 months ago (2015-08-31 13:54:09 UTC) #19
caitp (gmail)
On 2015/08/31 13:54:09, wingo wrote: > Hi :) > > On 2015/08/31 13:23:40, caitp wrote: ...
5 years, 3 months ago (2015-08-31 14:07:33 UTC) #20
adamk
This is looking good to me, will look once more after you've handled the rest ...
5 years, 3 months ago (2015-08-31 20:44:10 UTC) #22
caitp (gmail)
On 2015/08/31 20:44:10, adamk wrote: > This is looking good to me, will look once ...
5 years, 3 months ago (2015-08-31 21:03:50 UTC) #23
adamk
lgtm % one more wingo comment I point to https://codereview.chromium.org/1272673003/diff/110001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1272673003/diff/110001/src/parser.cc#newcode4414 src/parser.cc:4414: ...
5 years, 3 months ago (2015-08-31 21:17:28 UTC) #24
caitp (gmail)
https://codereview.chromium.org/1272673003/diff/110001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1272673003/diff/110001/src/parser.cc#newcode4422 src/parser.cc:4422: DCHECK_NULL(parameter.initializer); On 2015/08/31 21:17:28, adamk wrote: > That'll get ...
5 years, 3 months ago (2015-08-31 22:43:15 UTC) #25
Benedikt Meurer
LGTM with question and nit. https://codereview.chromium.org/1272673003/diff/150001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1272673003/diff/150001/src/parser.cc#newcode4415 src/parser.cc:4415: // for (var $argument_index ...
5 years, 3 months ago (2015-09-01 03:09:10 UTC) #26
caitp (gmail)
https://codereview.chromium.org/1272673003/diff/150001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1272673003/diff/150001/src/parser.cc#newcode4415 src/parser.cc:4415: // for (var $argument_index = $rest_index; On 2015/09/01 03:09:10, ...
5 years, 3 months ago (2015-09-01 03:55:02 UTC) #27
Benedikt Meurer
On 2015/09/01 03:55:02, caitp wrote: > https://codereview.chromium.org/1272673003/diff/150001/src/parser.cc > File src/parser.cc (right): > > https://codereview.chromium.org/1272673003/diff/150001/src/parser.cc#newcode4415 > ...
5 years, 3 months ago (2015-09-01 04:02:15 UTC) #28
Benedikt Meurer
On 2015/09/01 04:02:15, Benedikt Meurer wrote: > On 2015/09/01 03:55:02, caitp wrote: > > https://codereview.chromium.org/1272673003/diff/150001/src/parser.cc ...
5 years, 3 months ago (2015-09-01 04:42:33 UTC) #29
wingo
Some more nits. I defer to Adam's review of course. https://codereview.chromium.org/1272673003/diff/150001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1272673003/diff/150001/src/parser.cc#newcode4187 ...
5 years, 3 months ago (2015-09-01 14:41:20 UTC) #30
caitp (gmail)
https://codereview.chromium.org/1272673003/diff/150001/src/preparser.h File src/preparser.h (right): https://codereview.chromium.org/1272673003/diff/150001/src/preparser.h#newcode34 src/preparser.h:34: mutable int rest_array_literal_index = -1; On 2015/09/01 14:41:20, wingo ...
5 years, 3 months ago (2015-09-01 15:17:25 UTC) #31
adamk
https://codereview.chromium.org/1272673003/diff/150001/src/preparser.h File src/preparser.h (right): https://codereview.chromium.org/1272673003/diff/150001/src/preparser.h#newcode34 src/preparser.h:34: mutable int rest_array_literal_index = -1; On 2015/09/01 15:17:24, caitp ...
5 years, 3 months ago (2015-09-01 15:43:13 UTC) #32
wingo
LGTM, thanks for humoring my nitpicking, doing the perfect thing seems impossible here. Regarding desugaring: ...
5 years, 3 months ago (2015-09-01 16:03:18 UTC) #33
caitp (gmail)
On 2015/09/01 16:03:18, wingo wrote: > LGTM, thanks for humoring my nitpicking, doing the perfect ...
5 years, 3 months ago (2015-09-01 23:09:12 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1272673003/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1272673003/190001
5 years, 3 months ago (2015-09-01 23:09:34 UTC) #37
commit-bot: I haz the power
Try jobs failed on following builders: v8_android_arm_compile_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_android_arm_compile_rel/builds/7472) v8_linux64_asan_rel on tryserver.v8 (JOB_FAILED, ...
5 years, 3 months ago (2015-09-01 23:10:43 UTC) #39
caitp (gmail)
On 2015/09/01 23:10:43, commit-bot: I haz the power wrote: > Try jobs failed on following ...
5 years, 3 months ago (2015-09-01 23:28:26 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1272673003/210001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1272673003/210001
5 years, 3 months ago (2015-09-01 23:32:44 UTC) #43
commit-bot: I haz the power
Try jobs failed on following builders: v8_linux_mips64el_compile_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_mips64el_compile_rel/builds/4291)
5 years, 3 months ago (2015-09-01 23:37:10 UTC) #45
caitp (gmail)
On 2015/09/01 23:37:10, commit-bot: I haz the power wrote: > Try jobs failed on following ...
5 years, 3 months ago (2015-09-01 23:47:04 UTC) #46
caitp (gmail)
On 2015/09/01 23:47:04, caitp wrote: > On 2015/09/01 23:37:10, commit-bot: I haz the power wrote: ...
5 years, 3 months ago (2015-09-02 00:22:14 UTC) #47
rossberg
Parser changes LGTM, haven't looked at the rest.
5 years, 3 months ago (2015-09-02 00:55:27 UTC) #48
caitp (gmail)
On 2015/09/02 00:55:27, rossberg wrote: > Parser changes LGTM, haven't looked at the rest. Hey, ...
5 years, 3 months ago (2015-09-02 20:09:42 UTC) #49
caitp (gmail)
https://codereview.chromium.org/1272673003/diff/230001/src/parser.h File src/parser.h (right): https://codereview.chromium.org/1272673003/diff/230001/src/parser.h#newcode1324 src/parser.h:1324: !is_rest && pattern->IsVariableProxy() && initializer == nullptr; This makes ...
5 years, 3 months ago (2015-09-02 20:11:31 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1272673003/230001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1272673003/230001
5 years, 3 months ago (2015-09-02 20:43:27 UTC) #53
rossberg
https://codereview.chromium.org/1272673003/diff/230001/src/parser.h File src/parser.h (right): https://codereview.chromium.org/1272673003/diff/230001/src/parser.h#newcode1324 src/parser.h:1324: !is_rest && pattern->IsVariableProxy() && initializer == nullptr; On 2015/09/02 ...
5 years, 3 months ago (2015-09-02 20:44:10 UTC) #54
commit-bot: I haz the power
Committed patchset #13 (id:230001)
5 years, 3 months ago (2015-09-02 21:10:58 UTC) #55
commit-bot: I haz the power
Patchset 13 (id:??) landed as https://crrev.com/510baeacbab311798d5e8795800ff773d00d062c Cr-Commit-Position: refs/heads/master@{#30550}
5 years, 3 months ago (2015-09-02 21:11:14 UTC) #56
caitp (gmail)
On 2015/09/02 21:11:14, commit-bot: I haz the power wrote: > Patchset 13 (id:??) landed as ...
5 years, 3 months ago (2015-09-04 12:34:32 UTC) #57
caitp (gmail)
On 2015/09/04 12:34:32, caitp wrote: > On 2015/09/02 21:11:14, commit-bot: I haz the power wrote: ...
5 years, 3 months ago (2015-09-04 12:45:23 UTC) #58
caitp (gmail)
On 2015/09/04 12:45:23, caitp wrote: > On 2015/09/04 12:34:32, caitp wrote: > > On 2015/09/02 ...
5 years, 3 months ago (2015-09-04 12:56:34 UTC) #59
caitp (gmail)
On 2015/09/04 12:56:34, caitp wrote: > On 2015/09/04 12:45:23, caitp wrote: > > On 2015/09/04 ...
5 years, 3 months ago (2015-09-04 22:52:50 UTC) #60
caitp (gmail)
5 years, 3 months ago (2015-09-04 22:59:00 UTC) #61
Message was sent while issue was closed.
On 2015/09/04 22:52:50, caitp wrote:
> On 2015/09/04 12:56:34, caitp wrote:
> > On 2015/09/04 12:45:23, caitp wrote:
> > > On 2015/09/04 12:34:32, caitp wrote:
> > > > On 2015/09/02 21:11:14, commit-bot: I haz the power wrote:
> > > > > Patchset 13 (id:??) landed as
> > > > > https://crrev.com/510baeacbab311798d5e8795800ff773d00d062c
> > > > > Cr-Commit-Position: refs/heads/master@{#30550}
> > > > 
> > > > Based on a simple microbenchmark,
http://jsperf.com/v8-rest-parameters3/2,
> > > this
> > > > may have been more damaging to perf than I thought it would be :( This
> > > surprises
> > > > me a bit
> > > 
> > > Actually, I may have spoken too soon. I guess the xeon in my mac pro just
> gets
> > > through these tests slower than the i7 in my laptop. It still seems to be
> > > slightly faster than the old implementation
> > > http://jsperf.com/v8-rest-parameters3/3
> > 
> > Spoke too soon again, console.log was weighing heavier on the tests than I
> > thought :( http://jsperf.com/v8-rest-parameters2/4 so, the old
implementation
> > was faster :\ This is confusing since the desugaring is very similar to
> babel's
> > implementation
> 
> http://jsperf.com/v8-rest-parameters2/5 did some experimentation to see why
the
> babel impl does so much better, the biggest problem seems to be the use of
"let"
> (providing us with the proper TDZ). Some other improvements can also be
obtained
> via pre allocating the rest array rather than using the empty array literal.
> 
> (The bare*_func() versions do not exactly match the desugaring, due to not
using
> %AppendElement() and instead using babel-style assignment, which is not
> technically correct per-spec).
> 
> Things to improve include making `let` declarations faster in general (quite
> possibly related to hole-checking :() and pre-allocating the array size while
> still using the fastest spec-correct means of filling in the values.

Oh, the other thing is that the hole-checking isn't actually needed at all
unless there are binding patterns or default parameters in the formals. So,
using `var` instead of `let` in those cases would definitely speed things up.

Powered by Google App Engine
This is Rietveld 408576698