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

Issue 2082263002: [turbofan]: Support using push instructions for setting up tail call parameters (Closed)

Created:
4 years, 6 months ago by danno
Modified:
4 years, 5 months ago
CC:
v8-reviews_googlegroups.com, v8-x87-ports_googlegroups.com, Igor Sheludko
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[turbofan]: Support using push instructions for setting up tail call parameters This optimizes the passing of stack parameters in function calls. For some architectures (ia32/x64), using pushes when possible instead of bumping the stack and then storing parameters generates much smaller code, and in some cases is faster (e.g. when a push of a memory location can implement a memory-to-memory copy and thus elide an intermediate load. On others (e.g. ARM), the benefit is smaller, where it's only possible to elide direct stack pointer adjustment in certain cases or combine multiple register stores into a single instruction in other limited situations. On yet other platforms (ARM64, MIPS), there are no push instructions, and this optimization isn't used at all. Ideally, this mechanism would be used for both tail calls and normal calls, but "normal" calls are currently pretty efficient, and tail calls are very inefficient, so this CL sets the bar low for building a new mechanism to handle parameter pushing that only needs to raise the bar on tail calls for now. The key aspect of this change is that adjustment to the stack pointer for tail calls (and perhaps later real calls) is an explicit step separate from instruction selection and gap resolution, but aware of both, making it possible to safely recognize gap moves that are actually pushes. Committed: https://crrev.com/bd0d9e7d87d418b0c6a84f298e27058645083dad Cr-Commit-Position: refs/heads/master@{#37477}

Patch Set 1 #

Patch Set 2 : Remove dead code #

Patch Set 3 : Remove stray changes #

Patch Set 4 : Simplify #

Patch Set 5 : x64 port #

Patch Set 6 : MIPS ports #

Patch Set 7 : All platforms #

Patch Set 8 : Fix 64 bit #

Patch Set 9 : More fixes #

Patch Set 10 : Latest #

Patch Set 11 : Fix stuff #

Patch Set 12 : Fix ia32 #

Patch Set 13 : Should work better #

Patch Set 14 : Tweaks #

Patch Set 15 : Fix x64 C calling #

Patch Set 16 : Fix memory leak #

Patch Set 17 : Fix comment #

Patch Set 18 : Remove stray test #

Patch Set 19 : Remove stray test change #

Total comments: 18

Patch Set 20 : Review feedback #

Total comments: 6

Patch Set 21 : Review feedback #

Patch Set 22 : Fix comment #

Patch Set 23 : Review feedback #

Patch Set 24 : Fix comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+510 lines, -167 lines) Patch
M src/compiler/arm/code-generator-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 7 chunks +114 lines, -22 lines 0 comments Download
M src/compiler/arm64/code-generator-arm64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 7 chunks +37 lines, -22 lines 0 comments Download
M src/compiler/code-generator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 3 chunks +40 lines, -10 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 20 21 22 4 chunks +97 lines, -12 lines 0 comments Download
M src/compiler/gap-resolver.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +0 lines, -1 line 0 comments Download
M src/compiler/ia32/code-generator-ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 6 chunks +67 lines, -22 lines 0 comments Download
M src/compiler/instruction-selector.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +1 line, -1 line 0 comments Download
M src/compiler/instruction-selector.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +5 lines, -3 lines 0 comments Download
M src/compiler/linkage.h View 1 chunk +1 line, -1 line 0 comments Download
M src/compiler/linkage.cc View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -2 lines 0 comments Download
M src/compiler/mips/code-generator-mips.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 8 chunks +37 lines, -22 lines 0 comments Download
M src/compiler/mips64/code-generator-mips64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 7 chunks +37 lines, -22 lines 0 comments Download
M src/compiler/move-optimizer.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, -1 line 0 comments Download
M src/compiler/x64/code-generator-x64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 7 chunks +67 lines, -22 lines 0 comments Download
M test/unittests/compiler/linkage-tail-call-unittest.cc View 4 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 24 (12 generated)
danno
This is still a WIP, but was curious about feedback before taking it further.
4 years, 6 months ago (2016-06-22 09:37:54 UTC) #3
Benedikt Meurer
4 years, 6 months ago (2016-06-23 04:16:31 UTC) #5
danno
PTAL. I cleaned this up and completed the push support on ia32, x64 and ARM ...
4 years, 5 months ago (2016-06-29 09:24:39 UTC) #6
Benedikt Meurer
Mircea should probably also have a look at this. As discussed offline, this is fine ...
4 years, 5 months ago (2016-06-30 07:57:07 UTC) #9
Mircea Trofin
LGTM, some comments (in 2 different revisions, it turns out) please also add an explanation ...
4 years, 5 months ago (2016-06-30 15:32:34 UTC) #10
Jarin
lgtm. However, this is what I was worried about when I did not like the ...
4 years, 5 months ago (2016-06-30 16:48:04 UTC) #13
Mircea Trofin
On 2016/06/30 16:48:04, Jarin wrote: > lgtm. > > However, this is what I was ...
4 years, 5 months ago (2016-06-30 16:54:48 UTC) #14
danno
I moved the push detection logic out of gap resolver and tried to address Mircea ...
4 years, 5 months ago (2016-07-01 07:31:57 UTC) #15
Jarin
lgtm, I find it quite a bit clearer now. Thanks!
4 years, 5 months ago (2016-07-01 09:37:15 UTC) #16
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/2082263002/450001
4 years, 5 months ago (2016-07-01 11:04:22 UTC) #20
commit-bot: I haz the power
Committed patchset #24 (id:450001)
4 years, 5 months ago (2016-07-01 11:28:11 UTC) #22
commit-bot: I haz the power
4 years, 5 months ago (2016-07-01 11:28:35 UTC) #24
Message was sent while issue was closed.
Patchset 24 (id:??) landed as
https://crrev.com/bd0d9e7d87d418b0c6a84f298e27058645083dad
Cr-Commit-Position: refs/heads/master@{#37477}

Powered by Google App Engine
This is Rietveld 408576698