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

Issue 1108563002: Detect simple tail calls (Closed)

Created:
5 years, 8 months ago by Sven Panne
Modified:
5 years, 7 months ago
Reviewers:
Benedikt Meurer
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Detect simple tail calls This CL contains the first steps towards tail call optimization: * Structurally detect tail calls during instruction selection, looking for special return/call combinations. * Added new architecture-specific instructions for tail calls which jump instead of call and take care of frame adjustment. * Moved some code around. Currently we restrict tail calls to callees which only use registers for arguments/return value and to call sites which are explicitly marked as being OK for tail calls. This excludes, among other things, call sites in sloppy JS functions and our IC machinery (both need in general to be able to access the caller's frame). All this is behind a flag --turbo-tail-calls, which is currently off by default, so it can easily be toggled. Committed: https://crrev.com/4b122b7504ab458faa4132c338809b40147751bf Cr-Commit-Position: refs/heads/master@{#28150}

Patch Set 1 #

Patch Set 2 : Reworked and rebased. #

Patch Set 3 : x64 #

Patch Set 4 : Handle callers with args #

Total comments: 12

Patch Set 5 : Review feedback #

Patch Set 6 : Platform ports #

Patch Set 7 : Fixed ARM64 #

Patch Set 8 : Added test #

Patch Set 9 : Check return locations. Rebased. #

Patch Set 10 : Fixed index type #

Unified diffs Side-by-side diffs Delta from patch set Stats (+512 lines, -75 lines) Patch
M src/compiler.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M src/compiler/arm/code-generator-arm.cc View 1 2 3 4 5 3 chunks +40 lines, -0 lines 0 comments Download
M src/compiler/arm/instruction-selector-arm.cc View 1 2 3 4 5 3 chunks +9 lines, -6 lines 0 comments Download
M src/compiler/arm64/code-generator-arm64.cc View 1 2 3 4 5 6 3 chunks +41 lines, -0 lines 0 comments Download
M src/compiler/arm64/instruction-selector-arm64.cc View 1 2 3 4 5 3 chunks +9 lines, -6 lines 0 comments Download
M src/compiler/code-generator.h View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M src/compiler/ia32/code-generator-ia32.cc View 1 2 3 4 5 6 7 8 3 chunks +39 lines, -0 lines 0 comments Download
M src/compiler/ia32/instruction-selector-ia32.cc View 1 2 3 4 5 3 chunks +9 lines, -6 lines 0 comments Download
M src/compiler/instruction-codes.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M src/compiler/instruction-selector.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M src/compiler/instruction-selector.cc View 1 2 3 4 5 6 7 8 5 chunks +45 lines, -5 lines 0 comments Download
M src/compiler/js-generic-lowering.cc View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M src/compiler/linkage.h View 1 2 3 4 5 6 7 8 4 chunks +18 lines, -0 lines 0 comments Download
M src/compiler/linkage.cc View 1 2 3 4 5 6 7 8 9 2 chunks +22 lines, -1 line 0 comments Download
M src/compiler/linkage-impl.h View 1 2 3 1 chunk +10 lines, -9 lines 0 comments Download
M src/compiler/mips/code-generator-mips.cc View 1 2 3 4 5 3 chunks +38 lines, -0 lines 0 comments Download
M src/compiler/mips/instruction-selector-mips.cc View 1 2 3 4 5 3 chunks +9 lines, -6 lines 0 comments Download
M src/compiler/mips64/code-generator-mips64.cc View 1 2 3 4 5 3 chunks +38 lines, -0 lines 0 comments Download
M src/compiler/mips64/instruction-selector-mips64.cc View 1 2 3 4 5 3 chunks +10 lines, -6 lines 0 comments Download
M src/compiler/node-properties.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/compiler/node-properties.cc View 1 1 chunk +9 lines, -0 lines 0 comments Download
M src/compiler/ppc/code-generator-ppc.cc View 1 2 3 4 5 4 chunks +41 lines, -1 line 0 comments Download
M src/compiler/ppc/instruction-selector-ppc.cc View 1 2 3 4 5 3 chunks +10 lines, -7 lines 0 comments Download
M src/compiler/scheduler.cc View 1 3 chunks +2 lines, -9 lines 0 comments Download
M src/compiler/x64/code-generator-x64.cc View 1 2 3 4 5 6 7 8 3 chunks +40 lines, -0 lines 0 comments Download
M src/compiler/x64/instruction-selector-x64.cc View 1 2 3 chunks +9 lines, -6 lines 0 comments Download
M src/flag-definitions.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M src/globals.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M src/hydrogen-instructions.h View 1 2 3 4 1 chunk +0 lines, -3 lines 0 comments Download
M test/unittests/compiler/instruction-selector-unittest.cc View 1 2 3 4 5 6 7 8 2 chunks +48 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (3 generated)
Sven Panne
Currently x64 port only and no test, just to get an initial round of review ...
5 years, 7 months ago (2015-04-28 12:00:04 UTC) #2
Benedikt Meurer
https://codereview.chromium.org/1108563002/diff/60001/src/compiler/instruction-selector.cc File src/compiler/instruction-selector.cc (right): https://codereview.chromium.org/1108563002/diff/60001/src/compiler/instruction-selector.cc#newcode1046 src/compiler/instruction-selector.cc:1046: static Node* DetectTailCall(Node* ret) { Nit: Use anonymous namespace ...
5 years, 7 months ago (2015-04-29 04:06:06 UTC) #3
Sven Panne
Feedback addressed, platform ports added, PTAL... https://codereview.chromium.org/1108563002/diff/60001/src/compiler/instruction-selector.cc File src/compiler/instruction-selector.cc (right): https://codereview.chromium.org/1108563002/diff/60001/src/compiler/instruction-selector.cc#newcode1046 src/compiler/instruction-selector.cc:1046: static Node* DetectTailCall(Node* ...
5 years, 7 months ago (2015-04-29 10:24:18 UTC) #4
Benedikt Meurer
How about some tests?
5 years, 7 months ago (2015-04-29 10:27:07 UTC) #5
Sven Panne
Test added, PTAL...
5 years, 7 months ago (2015-04-29 13:39:51 UTC) #6
Benedikt Meurer
LGTM
5 years, 7 months ago (2015-04-30 07:33:21 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1108563002/170001
5 years, 7 months ago (2015-04-30 08:50:03 UTC) #10
commit-bot: I haz the power
Committed patchset #10 (id:170001)
5 years, 7 months ago (2015-04-30 09:10:27 UTC) #11
commit-bot: I haz the power
5 years, 7 months ago (2015-04-30 09:10:41 UTC) #12
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/4b122b7504ab458faa4132c338809b40147751bf
Cr-Commit-Position: refs/heads/master@{#28150}

Powered by Google App Engine
This is Rietveld 408576698