Detect simple tail calls
authorsvenpanne <svenpanne@chromium.org>
Thu, 30 Apr 2015 09:10:21 +0000 (02:10 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 30 Apr 2015 09:10:28 +0000 (09:10 +0000)
commit4b122b7504ab458faa4132c338809b40147751bf
tree413ba7b56c0ab23448f1ef88f34b42eb997a0320
parentab25d39349d5a0ecbaeee4299e9d749fd77bbef1
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.

Review URL: https://codereview.chromium.org/1108563002

Cr-Commit-Position: refs/heads/master@{#28150}
30 files changed:
src/compiler.cc
src/compiler/arm/code-generator-arm.cc
src/compiler/arm/instruction-selector-arm.cc
src/compiler/arm64/code-generator-arm64.cc
src/compiler/arm64/instruction-selector-arm64.cc
src/compiler/code-generator.h
src/compiler/ia32/code-generator-ia32.cc
src/compiler/ia32/instruction-selector-ia32.cc
src/compiler/instruction-codes.h
src/compiler/instruction-selector.cc
src/compiler/instruction-selector.h
src/compiler/js-generic-lowering.cc
src/compiler/linkage-impl.h
src/compiler/linkage.cc
src/compiler/linkage.h
src/compiler/mips/code-generator-mips.cc
src/compiler/mips/instruction-selector-mips.cc
src/compiler/mips64/code-generator-mips64.cc
src/compiler/mips64/instruction-selector-mips64.cc
src/compiler/node-properties.cc
src/compiler/node-properties.h
src/compiler/ppc/code-generator-ppc.cc
src/compiler/ppc/instruction-selector-ppc.cc
src/compiler/scheduler.cc
src/compiler/x64/code-generator-x64.cc
src/compiler/x64/instruction-selector-x64.cc
src/flag-definitions.h
src/globals.h
src/hydrogen-instructions.h
test/unittests/compiler/instruction-selector-unittest.cc