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

Issue 2803853005: Inline Array.prototype.forEach in TurboFan (Closed)

Created:
3 years, 8 months ago by danno
Modified:
3 years, 6 months ago
CC:
v8-reviews_googlegroups.com, mvstanton, rmcilroy
Target Ref:
refs/heads/master
Project:
v8
Visibility:
Public.

Description

Inline Array.prototype.forEach in TurboFan This CL contains a few pieces: - A new mechanism to create "BuiltinContinuation" checkpoints in TurboFan graphs, which--when triggered--swizzle the values in the the FrameState to be parameters to a typically TF-generated builtin that resumes execution to finish the slow-case functionality. - Continuation builtins that have special handling in the deoptimizer and their own new frame type to ensure that the values they need to begin executing can be stashed away and restored immediately before the builtin is called via a trampoline that runs when the continuation builtin's frame execution resumes. - An implementation of Array.prototype.forEach in TurboFan that can be used to inline it. The inlined forEach implementation uses the checkpoints mechanism described above to deopt in the middle of the forEach in the cases that optimization invariants are violated. There is a slightly different continuation stub for each deopt point in the forEach implementation to ensure the correct side-effects, i.e. that the deopt of the builtin isn't programmatically observable. Review-Url: https://codereview.chromium.org/2803853005 Cr-Commit-Position: refs/heads/master@{#45764} Committed: https://chromium.googlesource.com/v8/v8/+/90c3a2d54b956d06ace2c97c6bfdb10ea9cb8e58

Patch Set 1 #

Patch Set 2 : Checkpoint #

Patch Set 3 : Fix format #

Patch Set 4 : Tweaks #

Patch Set 5 : Add comments #

Total comments: 6

Patch Set 6 : Review feedback #

Total comments: 4

Patch Set 7 : Cleanup #

Total comments: 8

Patch Set 8 : Remove stray changes #

Patch Set 9 : Checkpoint #

Patch Set 10 : MIPS ports #

Patch Set 11 : MIPS ports #

Patch Set 12 : Fix windows build #

Patch Set 13 : fix v8heapconst.py #

Total comments: 46

Patch Set 14 : Address reviewer feedback #

Patch Set 15 : Merge with ToT #

Patch Set 16 : Fix stack traces #

Patch Set 17 : Merge with ToT #

Patch Set 18 : Fix tests #

Patch Set 19 : Remove stray changes #

Total comments: 6

Patch Set 20 : Review feedback and fix test cases #

Total comments: 8

Patch Set 21 : Review feedback #

Patch Set 22 : Disable new array builtins by default #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1659 lines, -55 lines) Patch
M src/builtins/arm/builtins-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +63 lines, -0 lines 0 comments Download
M src/builtins/arm64/builtins-arm64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +69 lines, -0 lines 0 comments Download
M src/builtins/builtins.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +6 lines, -0 lines 0 comments Download
M src/builtins/builtins.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 chunks +59 lines, -4 lines 0 comments Download
M src/builtins/builtins-array-gen.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +32 lines, -0 lines 0 comments Download
M src/builtins/builtins-definitions.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +39 lines, -0 lines 0 comments Download
M src/builtins/ia32/builtins-ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +66 lines, -0 lines 0 comments Download
M src/builtins/mips/builtins-mips.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +64 lines, -0 lines 0 comments Download
M src/builtins/mips64/builtins-mips64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +64 lines, -0 lines 0 comments Download
M src/builtins/x64/builtins-x64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +66 lines, -0 lines 0 comments Download
M src/compiler/code-generator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +16 lines, -0 lines 0 comments Download
M src/compiler/frame-states.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 5 chunks +25 lines, -2 lines 0 comments Download
M src/compiler/frame-states.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +116 lines, -0 lines 0 comments Download
M src/compiler/instruction.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +2 lines, -1 line 0 comments Download
M src/compiler/js-call-reducer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +1 line, -0 lines 0 comments Download
M src/compiler/js-call-reducer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +129 lines, -0 lines 0 comments Download
M src/deoptimizer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +41 lines, -27 lines 0 comments Download
M src/deoptimizer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 8 chunks +364 lines, -0 lines 0 comments Download
M src/flag-definitions.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -0 lines 0 comments Download
M src/frames.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 5 chunks +70 lines, -18 lines 0 comments Download
M src/frames.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 6 chunks +19 lines, -2 lines 0 comments Download
M src/frames-inl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +11 lines, -1 line 0 comments Download
M src/isolate.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +1 line, -0 lines 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +12 lines, -0 lines 0 comments Download
M src/utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +7 lines, -0 lines 0 comments Download
A test/mjsunit/optimized-foreach.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +313 lines, -0 lines 0 comments Download
M tools/v8heapconst.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 70 (53 generated)
danno
[WIP] Please take a look at the overall design. Ports are missing, but x64 and ...
3 years, 7 months ago (2017-05-15 15:07:23 UTC) #6
Jarin
Only looked at deoptimizer.cc. The overall approach looks good, I have only minor comments there. ...
3 years, 7 months ago (2017-05-16 20:00:04 UTC) #9
danno
Please take another look. For a feeling of how both JavaScript and normal builtin continuations ...
3 years, 7 months ago (2017-05-17 10:54:18 UTC) #10
Benedikt Meurer
https://codereview.chromium.org/2803853005/diff/100001/src/builtins/builtins-conversion-gen.cc File src/builtins/builtins-conversion-gen.cc (right): https://codereview.chromium.org/2803853005/diff/100001/src/builtins/builtins-conversion-gen.cc#newcode255 src/builtins/builtins-conversion-gen.cc:255: TF_BUILTIN(ToBooleanLazyDeoptContinuation, CodeStubAssembler) { That should be in a separate ...
3 years, 7 months ago (2017-05-18 06:32:52 UTC) #11
danno
Feedback addressed. Please take another look. https://codereview.chromium.org/2803853005/diff/100001/src/builtins/builtins-conversion-gen.cc File src/builtins/builtins-conversion-gen.cc (right): https://codereview.chromium.org/2803853005/diff/100001/src/builtins/builtins-conversion-gen.cc#newcode255 src/builtins/builtins-conversion-gen.cc:255: TF_BUILTIN(ToBooleanLazyDeoptContinuation, CodeStubAssembler) { ...
3 years, 7 months ago (2017-05-22 10:28:11 UTC) #30
Benedikt Meurer
Next round of comments (only looked at compiler). https://codereview.chromium.org/2803853005/diff/240001/src/compiler/js-call-reducer.cc File src/compiler/js-call-reducer.cc (right): https://codereview.chromium.org/2803853005/diff/240001/src/compiler/js-call-reducer.cc#newcode373 src/compiler/js-call-reducer.cc:373: if ...
3 years, 7 months ago (2017-05-22 19:29:40 UTC) #31
Jarin
lgtm, modulo nits and Benedikt's comments. https://codereview.chromium.org/2803853005/diff/240001/src/builtins/builtins-definitions.h File src/builtins/builtins-definitions.h (right): https://codereview.chromium.org/2803853005/diff/240001/src/builtins/builtins-definitions.h#newcode172 src/builtins/builtins-definitions.h:172: /* directly. */ ...
3 years, 7 months ago (2017-05-24 06:41:22 UTC) #32
Michael Starzinger
https://codereview.chromium.org/2803853005/diff/240001/src/builtins/builtins-definitions.h File src/builtins/builtins-definitions.h (right): https://codereview.chromium.org/2803853005/diff/240001/src/builtins/builtins-definitions.h#newcode172 src/builtins/builtins-definitions.h:172: /* directly. */ \ On 2017/05/24 06:41:22, Jarin wrote: ...
3 years, 7 months ago (2017-05-24 13:54:59 UTC) #33
Michael Starzinger
The following test case seems to crash in the GC: (function() { var result = ...
3 years, 7 months ago (2017-05-24 14:14:59 UTC) #34
danno
Feedback addressed (hopefully all) and new tests added. Unfortunately, addressing one of the bugs that ...
3 years, 6 months ago (2017-06-06 12:04:53 UTC) #51
Michael Starzinger
Looking good. As discussed offline I found one more case where the stack trace is ...
3 years, 6 months ago (2017-06-06 14:06:48 UTC) #52
Michael Starzinger
https://codereview.chromium.org/2803853005/diff/360001/src/compiler/code-generator.cc File src/compiler/code-generator.cc (right): https://codereview.chromium.org/2803853005/diff/360001/src/compiler/code-generator.cc#newcode10 src/compiler/code-generator.cc:10: #include "src/callable.h" nit: Looks like a left-over, shouldn't be ...
3 years, 6 months ago (2017-06-06 14:32:54 UTC) #53
danno
Michi's feedback addressed, please take another look. https://codereview.chromium.org/2803853005/diff/360001/src/compiler/code-generator.cc File src/compiler/code-generator.cc (right): https://codereview.chromium.org/2803853005/diff/360001/src/compiler/code-generator.cc#newcode10 src/compiler/code-generator.cc:10: #include "src/callable.h" ...
3 years, 6 months ago (2017-06-07 09:00:56 UTC) #56
Michael Starzinger
LGTM from my end. Just one final set of nits. Thanks! https://codereview.chromium.org/2803853005/diff/380001/src/builtins/builtins.cc File src/builtins/builtins.cc (right): ...
3 years, 6 months ago (2017-06-07 09:47:04 UTC) #59
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/2803853005/420001
3 years, 6 months ago (2017-06-07 13:21:23 UTC) #66
commit-bot: I haz the power
Committed patchset #22 (id:420001) as https://chromium.googlesource.com/v8/v8/+/90c3a2d54b956d06ace2c97c6bfdb10ea9cb8e58
3 years, 6 months ago (2017-06-07 13:23:44 UTC) #69
danno
3 years, 6 months ago (2017-06-22 14:43:54 UTC) #70
Message was sent while issue was closed.
Feedback addressed, landed.

https://codereview.chromium.org/2803853005/diff/380001/src/builtins/builtins.cc
File src/builtins/builtins.cc (right):

https://codereview.chromium.org/2803853005/diff/380001/src/builtins/builtins....
src/builtins/builtins.cc:38: UNIMPLEMENTED();
On 2017/06/07 09:47:04, Michael Starzinger wrote:
> nit: s/UNIMPLEMENTED/UNREACHABLE/

Done.

https://codereview.chromium.org/2803853005/diff/380001/src/builtins/builtins....
src/builtins/builtins.cc:51: UNIMPLEMENTED();
On 2017/06/07 09:47:04, Michael Starzinger wrote:
> nit: s/UNIMPLEMENTED/UNREACHABLE/

Done.

https://codereview.chromium.org/2803853005/diff/380001/src/builtins/builtins....
src/builtins/builtins.cc:150: #undef CASE
On 2017/06/07 09:47:04, Michael Starzinger wrote:
> nit: s/CASE/CASE_OTHER/ in the #undef as well.

Done.

https://codereview.chromium.org/2803853005/diff/380001/src/deoptimize-reason.h
File src/deoptimize-reason.h (right):

https://codereview.chromium.org/2803853005/diff/380001/src/deoptimize-reason....
src/deoptimize-reason.h:17: V(ContinueToBuiltin, "continue to builtin")         
                      \
On 2017/06/07 09:47:04, Michael Starzinger wrote:
> nit: This deopt reason seems to be unused, can we drop it?

Done.

Powered by Google App Engine
This is Rietveld 408576698