New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 183 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
HW: All
NextAction: ----
OS: All
Priority: 3
Type: FeatureRequest



Sign in to add a comment
link

Issue 4698: Support ES6 tail call elimination

Reported by ishell@chromium.org, Jan 21 2016 Project Member

Issue description

Tracking bug;

Tail calls support for Full codegen.
 

Comment 1 by 76821325...@developer.gserviceaccount.com, Jan 26 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/6131ab1edd6e78be01ac90b8f0b0f4f27f308071

commit 6131ab1edd6e78be01ac90b8f0b0f4f27f308071
Author: ishell <ishell@chromium.org>
Date: Tue Jan 26 11:07:15 2016

[es6] Tail calls support.

This CL implements PrepareForTailCall() mentioned in ES6 spec for full codegen, Crankshaft and Turbofan.
When debugger is active tail calls are disabled.

Tail calling can be enabled by --harmony-tailcalls flag.

BUG=v8:4698
LOG=Y
TBR=rossberg@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#33509}

[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/arm/builtins-arm.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/arm/code-stubs-arm.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/arm64/builtins-arm64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/arm64/code-stubs-arm64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/ast/ast.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/bootstrapper.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/builtins.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/builtins.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/code-factory.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/code-factory.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/code-stubs.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/compiler/ast-graph-builder.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/compiler/bytecode-graph-builder.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/compiler/js-operator.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/compiler/js-operator.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/crankshaft/arm/lithium-codegen-arm.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/crankshaft/arm64/lithium-codegen-arm64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/crankshaft/hydrogen-instructions.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/crankshaft/hydrogen.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/crankshaft/ia32/lithium-codegen-ia32.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/crankshaft/mips/lithium-codegen-mips.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/crankshaft/mips64/lithium-codegen-mips64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/crankshaft/x64/lithium-codegen-x64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/flag-definitions.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/full-codegen/arm/full-codegen-arm.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/full-codegen/arm64/full-codegen-arm64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/full-codegen/full-codegen.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/full-codegen/ia32/full-codegen-ia32.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/full-codegen/mips/full-codegen-mips.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/full-codegen/mips64/full-codegen-mips64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/full-codegen/x64/full-codegen-x64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/globals.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/ia32/builtins-ia32.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/ia32/code-stubs-ia32.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/ia32/macro-assembler-ia32.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/ic/ic-state.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/ic/ic.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/ic/ic.h
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/mips/builtins-mips.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/mips/code-stubs-mips.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/mips64/builtins-mips64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/mips64/code-stubs-mips64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/parsing/parser.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/x64/builtins-x64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/x64/code-stubs-x64.cc
[modify] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/src/x64/macro-assembler-x64.cc
[add] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/test/mjsunit/es6/tail-call-proxies.js
[add] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/test/mjsunit/es6/tail-call-simple.js
[add] http://crrev.com/6131ab1edd6e78be01ac90b8f0b0f4f27f308071/test/mjsunit/es6/tail-call.js

Comment 2 by 76821325...@developer.gserviceaccount.com, Jan 26 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/95aedaa0c853749649c257fdf7b50cfe5be0eda4

commit 95aedaa0c853749649c257fdf7b50cfe5be0eda4
Author: mbrandy <mbrandy@us.ibm.com>
Date: Tue Jan 26 16:57:54 2016

PPC: [es6] Tail calls support.

Port 6131ab1edd6e78be01ac90b8f0b0f4f27f308071

Original commit message:
    This CL implements PrepareForTailCall() mentioned in ES6 spec for full codegen, Crankshaft and Turbofan.
    When debugger is active tail calls are disabled.

    Tail calling can be enabled by --harmony-tailcalls flag.

R=ishell@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:4698
LOG=Y

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

Cr-Commit-Position: refs/heads/master@{#33524}

[modify] http://crrev.com/95aedaa0c853749649c257fdf7b50cfe5be0eda4/src/crankshaft/ppc/lithium-codegen-ppc.cc
[modify] http://crrev.com/95aedaa0c853749649c257fdf7b50cfe5be0eda4/src/full-codegen/ppc/full-codegen-ppc.cc
[modify] http://crrev.com/95aedaa0c853749649c257fdf7b50cfe5be0eda4/src/ppc/builtins-ppc.cc
[modify] http://crrev.com/95aedaa0c853749649c257fdf7b50cfe5be0eda4/src/ppc/code-stubs-ppc.cc

Comment 3 by paulir...@chromium.org, Jan 26 2016

Cc: paulir...@chromium.org alph@chromium.org

Comment 4 by ishell@chromium.org, Feb 5 2016

Summary: Tail calls support for Full codegen and Crankshaft. (was: Tail calls support for Full codegen.)

Comment 5 by bugdroid1@chromium.org, Feb 11 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/e82588f647a3f38a73115b0c9f09a7041db2fe4b

commit e82588f647a3f38a73115b0c9f09a7041db2fe4b
Author: ishell <ishell@chromium.org>
Date: Thu Feb 11 09:58:38 2016

[crankshaft] Disable Crankshaft when it sees a tail call.

This CL also removes tail call support made so far from Crankshaft.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#33885}

[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/ast/ast-numbering.cc
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/bailout-reason.h
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/arm/lithium-codegen-arm.cc
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/arm64/lithium-codegen-arm64.cc
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/hydrogen-instructions.h
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/hydrogen.cc
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/ia32/lithium-codegen-ia32.cc
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/mips/lithium-codegen-mips.cc
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/mips64/lithium-codegen-mips64.cc
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/ppc/lithium-codegen-ppc.cc
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/x64/lithium-codegen-x64.cc
[modify] http://crrev.com/e82588f647a3f38a73115b0c9f09a7041db2fe4b/src/crankshaft/x87/lithium-codegen-x87.cc

Comment 6 by bugdroid1@chromium.org, Feb 11 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/e519e6fadfaf7242231f4dcb45910f60304e26fc

commit e519e6fadfaf7242231f4dcb45910f60304e26fc
Author: ishell <ishell@chromium.org>
Date: Thu Feb 11 10:26:39 2016

[es6] Further fixing of tail Calls.

1) Update profiling counters in Full codegen.
2) Call Runtime::kTraceTailCall when tracing is on

test/mjsunit/es6/tail-call-simple.js is disabled for now, because Turbofan does not fully support TCO yet.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#33886}

[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/src/full-codegen/arm/full-codegen-arm.cc
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/src/full-codegen/arm64/full-codegen-arm64.cc
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/src/full-codegen/full-codegen.h
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/src/full-codegen/ia32/full-codegen-ia32.cc
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/src/full-codegen/mips/full-codegen-mips.cc
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/src/full-codegen/mips64/full-codegen-mips64.cc
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/src/full-codegen/x64/full-codegen-x64.cc
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/src/runtime/runtime-test.cc
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/src/runtime/runtime.h
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/test/mjsunit/es6/tail-call-simple.js
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/test/mjsunit/function-caller.js
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/test/mjsunit/mjsunit.status
[modify] http://crrev.com/e519e6fadfaf7242231f4dcb45910f60304e26fc/test/mjsunit/strict-mode.js

Comment 7 by bugdroid1@chromium.org, Feb 11 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/d12dbab46618801b38430b614276002c178abf72

commit d12dbab46618801b38430b614276002c178abf72
Author: ishell <ishell@chromium.org>
Date: Thu Feb 11 17:39:43 2016

[es6] More efficient way of marking AST call expressions in tail positions.

Instead of doing a full function body traversal we collect return expressions and mark them after function parsing.

And since we rewrite do-expressions so that the result is explicitly assigned to a result variable the statements marking will never hit so I removed it from the AST.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#33911}

[modify] http://crrev.com/d12dbab46618801b38430b614276002c178abf72/src/ast/ast.h
[modify] http://crrev.com/d12dbab46618801b38430b614276002c178abf72/src/parsing/parser-base.h
[modify] http://crrev.com/d12dbab46618801b38430b614276002c178abf72/src/parsing/parser.cc
[modify] http://crrev.com/d12dbab46618801b38430b614276002c178abf72/src/parsing/parser.h
[modify] http://crrev.com/d12dbab46618801b38430b614276002c178abf72/test/mjsunit/es6/tail-call.js
[modify] http://crrev.com/d12dbab46618801b38430b614276002c178abf72/test/mjsunit/mjsunit.status

Comment 8 by ishell@chromium.org, Feb 12 2016

Summary: Support ES6 tail calls (was: Tail calls support for Full codegen and Crankshaft.)

Comment 9 by bugdroid1@chromium.org, Feb 12 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/d00644a011b5667f58ce713bcfb8e8cfcb254c2f

commit d00644a011b5667f58ce713bcfb8e8cfcb254c2f
Author: mbrandy <mbrandy@us.ibm.com>
Date: Fri Feb 12 15:12:13 2016

PPC: [es6] Further fixing of tail Calls.

Port e519e6fadfaf7242231f4dcb45910f60304e26fc

Original commit message:
    1) Update profiling counters in Full codegen.
    2) Call Runtime::kTraceTailCall when tracing is on

    test/mjsunit/es6/tail-call-simple.js is disabled for now, because Turbofan does not fully support TCO yet.

R=ishell@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#33951}

[modify] http://crrev.com/d00644a011b5667f58ce713bcfb8e8cfcb254c2f/src/full-codegen/ppc/full-codegen-ppc.cc

Comment 10 by bugdroid1@chromium.org, Feb 17 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/32b4bc138252d9773cc90b2d4aae78d98844bba1

commit 32b4bc138252d9773cc90b2d4aae78d98844bba1
Author: ishell <ishell@chromium.org>
Date: Wed Feb 17 15:19:02 2016

[es6] [interpreter] Add tail calls support to Ignition.

This CL introduces two new bytecodes TailCall and TailCallWide.

BUG=v8:4698, v8:4687 
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34083}

[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/arm/builtins-arm.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/arm64/builtins-arm64.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/builtins.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/builtins.h
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/code-factory.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/code-factory.h
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/compiler/bytecode-graph-builder.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/compiler/bytecode-graph-builder.h
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/ia32/builtins-ia32.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/interpreter/bytecode-array-builder.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/interpreter/bytecode-array-builder.h
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/interpreter/bytecode-generator.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/interpreter/bytecodes.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/interpreter/bytecodes.h
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/interpreter/interpreter-assembler.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/interpreter/interpreter-assembler.h
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/interpreter/interpreter.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/interpreter/interpreter.h
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/mips/builtins-mips.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/mips64/builtins-mips64.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/src/x64/builtins-x64.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/test/cctest/interpreter/test-interpreter.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/test/mjsunit/es6/tail-call-simple.js
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/test/mjsunit/mjsunit.status
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/test/unittests/interpreter/bytecode-array-builder-unittest.cc
[modify] http://crrev.com/32b4bc138252d9773cc90b2d4aae78d98844bba1/test/unittests/interpreter/interpreter-assembler-unittest.cc

Comment 11 by bugdroid1@chromium.org, Feb 17 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/c94a3d44bdd2e1a90e3cf385ffb6949f5bb74858

commit c94a3d44bdd2e1a90e3cf385ffb6949f5bb74858
Author: mbrandy <mbrandy@us.ibm.com>
Date: Wed Feb 17 21:27:45 2016

PPC: [es6] [interpreter] Add tail calls support to Ignition.

Port 32b4bc138252d9773cc90b2d4aae78d98844bba1

Original commit message:
    This CL introduces two new bytecodes TailCall and TailCallWide.

R=ishell@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:4698, v8:4687 
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34096}

[modify] http://crrev.com/c94a3d44bdd2e1a90e3cf385ffb6949f5bb74858/src/ppc/builtins-ppc.cc

Comment 12 by bugdroid1@chromium.org, Feb 18 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/c67b5096cd81af4bdf62591f36e5eb72a1c7446a

commit c67b5096cd81af4bdf62591f36e5eb72a1c7446a
Author: ishell <ishell@chromium.org>
Date: Thu Feb 18 10:12:54 2016

[turbofan] Fixing ES6 tail calls in Turbofan.

In case when F inlined normal call to G which tail calls H we should not write translation for G for the tail call site.
Otherwise we will see G in a stack trace inside H.

This CL also adds a "megatest" which tests product of the following cases:
1) tail caller is inlined/not-inlined
2) tail callee is inlined/not-inlined
3) tail caller has an arguments adaptor frame above or not
4) tail callee has an arguments adaptor frame above or not
5) tail callee is a normal/bound/proxy function

Note that tests for not yet supported cases are not run for now.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34108}

[modify] http://crrev.com/c67b5096cd81af4bdf62591f36e5eb72a1c7446a/src/compiler/instruction-selector.cc
[add] http://crrev.com/c67b5096cd81af4bdf62591f36e5eb72a1c7446a/test/mjsunit/es6/tail-call-megatest.js
[modify] http://crrev.com/c67b5096cd81af4bdf62591f36e5eb72a1c7446a/test/mjsunit/es6/tail-call.js

Comment 13 by bugdroid1@chromium.org, Feb 18 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/1d420199bf941e8b557b54ec7586392d29ffcbd2

commit 1d420199bf941e8b557b54ec7586392d29ffcbd2
Author: ishell <ishell@chromium.org>
Date: Thu Feb 18 13:46:00 2016

[es6] Disable tail call optimization in optimizing compilers for now.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34115}

[modify] http://crrev.com/1d420199bf941e8b557b54ec7586392d29ffcbd2/src/ast/ast-numbering.cc

Comment 14 by bugdroid1@chromium.org, Feb 18 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/e8201e6cc47204f5efc0092ba311a150eac1f022

commit e8201e6cc47204f5efc0092ba311a150eac1f022
Author: ishell <ishell@chromium.org>
Date: Thu Feb 18 14:16:03 2016

[es6] Enable tail call optimization on clusterfuzz.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34117}

[modify] http://crrev.com/e8201e6cc47204f5efc0092ba311a150eac1f022/src/flag-definitions.h

Comment 15 by littledan@chromium.org, Feb 19 2016

The folks at Bocoup wrote some tests for tail call optimization. Our TCO implementation passes all of their tests!

Comment 16 by bugdroid1@chromium.org, Feb 19 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/7624465b618a2d230e784aebe3d8b594a01dac29

commit 7624465b618a2d230e784aebe3d8b594a01dac29
Author: ishell <ishell@chromium.org>
Date: Fri Feb 19 08:39:31 2016

[es6] Fixed POSSIBLY_EVAL_CALL tail calls handling in Full codegen.

This CL also enhances a "tail-call-megatest" which now tests product of the following cases:
1) tail caller is inlined/not-inlined
2) tail callee is inlined/not-inlined
3) tail caller has an arguments adaptor frame above or not
4) tail callee has an arguments adaptor frame above or not
5) tail callee is a sloppy/strict/possibly eval/bound/proxy function
6) tail calling via normal call/function.apply/function.call

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34143}

[modify] https://crrev.com/7624465b618a2d230e784aebe3d8b594a01dac29/src/full-codegen/arm/full-codegen-arm.cc
[modify] https://crrev.com/7624465b618a2d230e784aebe3d8b594a01dac29/src/full-codegen/arm64/full-codegen-arm64.cc
[modify] https://crrev.com/7624465b618a2d230e784aebe3d8b594a01dac29/src/full-codegen/ia32/full-codegen-ia32.cc
[modify] https://crrev.com/7624465b618a2d230e784aebe3d8b594a01dac29/src/full-codegen/mips/full-codegen-mips.cc
[modify] https://crrev.com/7624465b618a2d230e784aebe3d8b594a01dac29/src/full-codegen/mips64/full-codegen-mips64.cc
[modify] https://crrev.com/7624465b618a2d230e784aebe3d8b594a01dac29/src/full-codegen/ppc/full-codegen-ppc.cc
[modify] https://crrev.com/7624465b618a2d230e784aebe3d8b594a01dac29/src/full-codegen/x64/full-codegen-x64.cc
[modify] https://crrev.com/7624465b618a2d230e784aebe3d8b594a01dac29/src/full-codegen/x87/full-codegen-x87.cc
[modify] https://crrev.com/7624465b618a2d230e784aebe3d8b594a01dac29/test/mjsunit/es6/tail-call-megatest.js

Comment 17 by littledan@chromium.org, Feb 24 2016

Cc: mstarzinger@chromium.org l...@chromium.org rossberg@chromium.org
 Issue 457  has been merged into this issue.

Comment 18 by e...@barzilay.org, Feb 24 2016

"When debugger is active tail calls are disabled."

This sounds like going down a path where running code can change its semantics depending  on the debugger being open or not.  Would some web pages fail if I have it open?  Would the original case from  issue 457  still fail because the console is part of the debugger?

And BTW, the more common term for this is "Tail Call Elimination", when it is a language feature rather than a random optimization.

Comment 19 by jon.ronn...@gmail.com, Feb 27 2016

You might interested in https://bugs.chromium.org/p/chromium/issues/detail?id=568695#c_id20452753 which is about what the devtools should show and behave like in TCO situations. Please chime in.

Comment 20 by bugdroid1@chromium.org, Mar 4 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/98c34e600dd0cff31caf314b9c7539200ff781f4

commit 98c34e600dd0cff31caf314b9c7539200ff781f4
Author: ishell <ishell@chromium.org>
Date: Fri Mar 04 09:17:28 2016

[crankshaft] Correctly propagate TailCallMode in case of inlining.

This CL also disables inlining of calls at tail position.

This is a preparational step. Tail call elimination itself is neither enabled nor supported yet.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34484}

[modify] https://crrev.com/98c34e600dd0cff31caf314b9c7539200ff781f4/src/crankshaft/hydrogen.cc
[modify] https://crrev.com/98c34e600dd0cff31caf314b9c7539200ff781f4/src/crankshaft/hydrogen.h

Comment 21 by bugdroid1@chromium.org, Mar 7 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/22938040fdb9a061babe96f004355fd79b2958a0

commit 22938040fdb9a061babe96f004355fd79b2958a0
Author: ishell <ishell@chromium.org>
Date: Mon Mar 07 14:33:54 2016

[crankshaft] Support ES6 tail call elimination.

HInvokeFunction and HApplyArguments instructions now support tail calling.

Inlining of calls at tail position is not supported yet and therefore still disabled.

The tail-call-megatest was modified so that the usages of "arguments" object do not disable Crankshaft.

TBR=bmeurer@chromium.org
BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34542}

[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/arm/builtins-arm.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/arm/macro-assembler-arm.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/arm/macro-assembler-arm.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/arm64/builtins-arm64.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/arm64/macro-assembler-arm64.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/arm64/macro-assembler-arm64.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/ast/ast-numbering.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/code-factory.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/code-factory.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/arm/lithium-arm.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/arm/lithium-codegen-arm.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/arm/lithium-codegen-arm.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/arm64/lithium-arm64.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/arm64/lithium-codegen-arm64.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/arm64/lithium-codegen-arm64.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/hydrogen-instructions.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/hydrogen.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/ia32/lithium-codegen-ia32.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/ia32/lithium-codegen-ia32.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/ia32/lithium-ia32.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/mips/lithium-codegen-mips.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/mips/lithium-codegen-mips.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/mips/lithium-mips.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/mips64/lithium-codegen-mips64.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/mips64/lithium-codegen-mips64.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/mips64/lithium-mips64.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/x64/lithium-codegen-x64.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/x64/lithium-codegen-x64.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/crankshaft/x64/lithium-x64.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/ia32/builtins-ia32.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/ia32/macro-assembler-ia32.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/ia32/macro-assembler-ia32.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/mips/builtins-mips.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/mips/macro-assembler-mips.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/mips/macro-assembler-mips.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/mips64/builtins-mips64.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/mips64/macro-assembler-mips64.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/mips64/macro-assembler-mips64.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/x64/builtins-x64.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/x64/macro-assembler-x64.cc
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/src/x64/macro-assembler-x64.h
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/test/mjsunit/es6/tail-call-megatest.js
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/test/mjsunit/es6/tail-call-simple.js
[modify] https://crrev.com/22938040fdb9a061babe96f004355fd79b2958a0/test/mjsunit/es6/tail-call.js

Comment 22 by bugdroid1@chromium.org, Mar 7 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/826f67bec35e1e2def0650dfa443f2534589f7a3

commit 826f67bec35e1e2def0650dfa443f2534589f7a3
Author: mbrandy <mbrandy@us.ibm.com>
Date: Mon Mar 07 20:55:03 2016

PPC: [crankshaft] Support ES6 tail call elimination.

Port 22938040fdb9a061babe96f004355fd79b2958a0

Original commit message:
    HInvokeFunction and HApplyArguments instructions now support tail calling.

    Inlining of calls at tail position is not supported yet and therefore still disabled.

    The tail-call-megatest was modified so that the usages of "arguments" object do not disable Crankshaft.

R=ishell@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34563}

[modify] https://crrev.com/826f67bec35e1e2def0650dfa443f2534589f7a3/src/crankshaft/ppc/lithium-codegen-ppc.cc
[modify] https://crrev.com/826f67bec35e1e2def0650dfa443f2534589f7a3/src/crankshaft/ppc/lithium-codegen-ppc.h
[modify] https://crrev.com/826f67bec35e1e2def0650dfa443f2534589f7a3/src/crankshaft/ppc/lithium-ppc.h
[modify] https://crrev.com/826f67bec35e1e2def0650dfa443f2534589f7a3/src/ppc/builtins-ppc.cc
[modify] https://crrev.com/826f67bec35e1e2def0650dfa443f2534589f7a3/src/ppc/macro-assembler-ppc.cc
[modify] https://crrev.com/826f67bec35e1e2def0650dfa443f2534589f7a3/src/ppc/macro-assembler-ppc.h

Comment 23 by bugdroid1@chromium.org, Mar 8 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/2aae579cf04b24f605d1ae6b975d67d8dbbee672

commit 2aae579cf04b24f605d1ae6b975d67d8dbbee672
Author: ishell <ishell@chromium.org>
Date: Tue Mar 08 00:11:57 2016

[turbofan] Further fixing ES6 tail call elimination in Turbofan.

In case when F tail calls G we should also remove the potential arguments adaptor frame for F.

This CL introduces two new machine instructions ArchTailCallCodeObjectFromJSFunction and ArchTailCallJSFunctionFromJSFunction which (unlike existing ArchTailCallCodeObject and ArchTailCallJSFunction) also drop arguments adaptor frame if it exists right before jumping to the target function.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34566}

[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/arm/code-generator-arm.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/arm/instruction-selector-arm.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/arm64/code-generator-arm64.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/arm64/instruction-selector-arm64.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/code-generator.h
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/ia32/code-generator-ia32.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/ia32/instruction-selector-ia32.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/instruction-codes.h
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/instruction-scheduler.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/instruction-selector.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/instruction-selector.h
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/mips/code-generator-mips.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/mips/instruction-selector-mips.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/mips64/code-generator-mips64.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/mips64/instruction-selector-mips64.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/x64/code-generator-x64.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/compiler/x64/instruction-selector-x64.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/crankshaft/ia32/lithium-codegen-ia32.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/ia32/builtins-ia32.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/ia32/macro-assembler-ia32.cc
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/src/ia32/macro-assembler-ia32.h
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/test/mjsunit/es6/tail-call-megatest.js
[modify] https://crrev.com/2aae579cf04b24f605d1ae6b975d67d8dbbee672/test/mjsunit/es6/tail-call-simple.js

Comment 24 by bugdroid1@chromium.org, Mar 8 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/fcaa643dab7757225697446dcdccd77417d2d899

commit fcaa643dab7757225697446dcdccd77417d2d899
Author: mbrandy <mbrandy@us.ibm.com>
Date: Tue Mar 08 14:51:44 2016

PPC: [turbofan] Further fixing ES6 tail call elimination in Turbofan.

Port 2aae579cf04b24f605d1ae6b975d67d8dbbee672

Original commit message:
    In case when F tail calls G we should also remove the potential arguments adaptor frame for F.

    This CL introduces two new machine instructions ArchTailCallCodeObjectFromJSFunction and
    ArchTailCallJSFunctionFromJSFunction which (unlike existing ArchTailCallCodeObject and
    ArchTailCallJSFunction) also drop arguments adaptor frame if it exists right before jumping
    to the target function.

R=ishell@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34589}

[modify] https://crrev.com/fcaa643dab7757225697446dcdccd77417d2d899/src/compiler/ppc/code-generator-ppc.cc
[modify] https://crrev.com/fcaa643dab7757225697446dcdccd77417d2d899/src/compiler/ppc/instruction-selector-ppc.cc

Comment 25 by ishell@chromium.org, Mar 8 2016

Summary: Support ES6 tail call elimination (was: Support ES6 tail calls)

Comment 26 by bugdroid1@chromium.org, Mar 9 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a

commit c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a
Author: ishell <ishell@chromium.org>
Date: Wed Mar 09 11:33:10 2016

[turbofan] [deoptimizer] Support inlining of ES6 tail calls.

In case when F was called with incompatible number of arguments (and therefore
the arguments adator frame was created), F inlines a tail call of G which then
deopts the deoptimizer should also remove the arguments adaptor frame for F.

This CL adds required machinery to the deoptimizer.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34610}

[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/arm/deoptimizer-arm.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/arm64/deoptimizer-arm64.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/compiler/code-generator.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/compiler/frame-states.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/compiler/frame-states.h
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/compiler/js-inlining.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/compiler/js-inlining.h
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/deoptimizer.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/deoptimizer.h
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/ia32/deoptimizer-ia32.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/mips/deoptimizer-mips.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/mips64/deoptimizer-mips64.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/objects-printer.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/objects.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/runtime/runtime-compiler.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/src/x64/deoptimizer-x64.cc
[modify] https://crrev.com/c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a/test/mjsunit/es6/tail-call-megatest.js

Comment 28 by bugdroid1@chromium.org, Mar 9 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/209c2152441faa9843140f1049575dee8333b7fd

commit 209c2152441faa9843140f1049575dee8333b7fd
Author: mbrandy <mbrandy@us.ibm.com>
Date: Wed Mar 09 23:09:21 2016

PPC: [turbofan] [deoptimizer] Support inlining of ES6 tail calls.

Port c29a4560bb548fa0ebeec8262f9d6fca9d50fe7a

Original commit message:
    In case when F was called with incompatible number of arguments (and therefore
    the arguments adator frame was created), F inlines a tail call of G which then
    deopts the deoptimizer should also remove the arguments adaptor frame for F.

    This CL adds required machinery to the deoptimizer.

R=ishell@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34644}

[modify] https://crrev.com/209c2152441faa9843140f1049575dee8333b7fd/src/ppc/deoptimizer-ppc.cc

Comment 29 by bugdroid1@chromium.org, Mar 10 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/01589fe708d623353158dcea857cc0cf660ff49e

commit 01589fe708d623353158dcea857cc0cf660ff49e
Author: mbrandy <mbrandy@us.ibm.com>
Date: Thu Mar 10 15:05:53 2016

Fix "[turbofan] [deoptimizer] Support inlining of ES6 tail calls" for embedded constant pools.

Correct handling of the bottom frame in DoComputeArgumentsAdaptorFrame.

R=ishell@chromium.org, jarin@chromium.org, michael_dawson@ca.ibm.com
BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34681}

[modify] https://crrev.com/01589fe708d623353158dcea857cc0cf660ff49e/src/deoptimizer.cc

Comment 30 by littledan@chromium.org, Mar 10 2016

Labels: Test262Failures

Comment 31 by hablich@chromium.org, Mar 11 2016

Labels: -test262failures Hotlist-test262

Comment 32 Deleted

Comment 33 Deleted

Comment 34 by bugdroid1@chromium.org, Mar 11 2016

Project Member

Comment 35 by bugdroid1@chromium.org, Mar 11 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/dd0e6ca04c14a5ff9fe26569255f98cebe6125fe

commit dd0e6ca04c14a5ff9fe26569255f98cebe6125fe
Author: ishell <ishell@chromium.org>
Date: Fri Mar 11 12:32:40 2016

[deoptimizer] Removed asserts that do not hold in case of tail call elimination.

These checks can fail if there bottommost function is a tail caller and the next function has different number of arguments than the bottommost one.

BUG= chromium:593697 ,v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34718}

[modify] https://crrev.com/dd0e6ca04c14a5ff9fe26569255f98cebe6125fe/src/deoptimizer.cc

Comment 36 by bugdroid1@chromium.org, Mar 16 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/689980f7d4dfd4c29492f616d7b616b86ec9af91

commit 689980f7d4dfd4c29492f616d7b616b86ec9af91
Author: ishell <ishell@chromium.org>
Date: Wed Mar 16 17:05:16 2016

[crankshaft] Fixing ES6 tail call elimination.

In case when F inlined normal call to G which tail calls H we should not write translation for G for the tail call site.
Otherwise we will see G in a stack trace inside H.

This CL also enables all existing tests related to ES6 tail call elimination.

TBR=bmeurer@chromium.org
BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34830}

[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/arm/lithium-arm.cc
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/arm/lithium-arm.h
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/arm64/lithium-arm64.cc
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/arm64/lithium-arm64.h
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/hydrogen-instructions.cc
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/hydrogen-instructions.h
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/hydrogen.cc
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/hydrogen.h
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/ia32/lithium-ia32.cc
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/ia32/lithium-ia32.h
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/lithium.cc
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/lithium.h
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/mips/lithium-mips.cc
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/mips/lithium-mips.h
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/mips64/lithium-mips64.cc
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/mips64/lithium-mips64.h
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/x64/lithium-x64.cc
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/src/crankshaft/x64/lithium-x64.h
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard0.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard1.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard2.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard3.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard4.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard5.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard6.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard7.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard8.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest-shard9.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-megatest.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call-simple.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/es6/tail-call.js
[modify] https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91/test/mjsunit/mjsunit.status

Comment 37 by bugdroid1@chromium.org, Mar 16 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/d64b41ded60d46114640f1473dfe9c48e8a1ccde

commit d64b41ded60d46114640f1473dfe9c48e8a1ccde
Author: machenbach <machenbach@chromium.org>
Date: Wed Mar 16 18:12:16 2016

Revert of [crankshaft] Fixing ES6 tail call elimination. (patchset #7 id:200001 of https://codereview.chromium.org/1780043004/ )

Reason for revert:
[Sheriff] Leads to mac gc stress crashes:
https://build.chromium.org/p/client.v8/builders/V8%20Mac%20GC%20Stress/builds/4975

Original issue's description:
> [crankshaft] Fixing ES6 tail call elimination.
>
> In case when F inlined normal call to G which tail calls H we should not write translation for G for the tail call site.
> Otherwise we will see G in a stack trace inside H.
>
> This CL also enables all existing tests related to ES6 tail call elimination.
>
> TBR=bmeurer@chromium.org
> BUG=v8:4698
> LOG=N
>
> Committed: https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91
> Cr-Commit-Position: refs/heads/master@{#34830}

TBR=mstarzinger@chromium.org,ishell@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4698

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

Cr-Commit-Position: refs/heads/master@{#34835}

[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/arm/lithium-arm.cc
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/arm/lithium-arm.h
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/arm64/lithium-arm64.cc
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/arm64/lithium-arm64.h
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/hydrogen-instructions.cc
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/hydrogen-instructions.h
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/hydrogen.cc
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/hydrogen.h
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/ia32/lithium-ia32.cc
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/ia32/lithium-ia32.h
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/lithium.cc
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/lithium.h
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/mips/lithium-mips.cc
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/mips/lithium-mips.h
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/mips64/lithium-mips64.cc
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/mips64/lithium-mips64.h
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/x64/lithium-x64.cc
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/src/crankshaft/x64/lithium-x64.h
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard0.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard1.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard2.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard3.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard4.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard5.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard6.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard7.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard8.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest-shard9.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-megatest.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call-simple.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/es6/tail-call.js
[modify] https://crrev.com/d64b41ded60d46114640f1473dfe9c48e8a1ccde/test/mjsunit/mjsunit.status

Comment 38 by bugdroid1@chromium.org, Mar 21 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/acbb968dedd2b02b5447215a579cf4cdc99bc69a

commit acbb968dedd2b02b5447215a579cf4cdc99bc69a
Author: ishell <ishell@chromium.org>
Date: Mon Mar 21 08:48:16 2016

[crankshaft] Fixing ES6 tail call elimination.

In case when F inlined normal call to G which tail calls H we should not write translation for G for the tail call site.
Otherwise we will see G in a stack trace inside H.

This CL also enables all existing tests related to ES6 tail call elimination and adds more combinations.

TBR=bmeurer@chromium.org
BUG=v8:4698
LOG=N

Committed: https://crrev.com/689980f7d4dfd4c29492f616d7b616b86ec9af91
Cr-Commit-Position: refs/heads/master@{#34830}

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

Cr-Commit-Position: refs/heads/master@{#34920}

[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/arm/lithium-arm.cc
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/arm/lithium-arm.h
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/arm64/lithium-arm64.cc
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/arm64/lithium-arm64.h
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/hydrogen-instructions.cc
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/hydrogen-instructions.h
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/hydrogen.cc
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/hydrogen.h
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/ia32/lithium-ia32.cc
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/ia32/lithium-ia32.h
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/lithium.cc
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/lithium.h
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/mips/lithium-mips.cc
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/mips/lithium-mips.h
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/mips64/lithium-mips64.cc
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/mips64/lithium-mips64.h
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/x64/lithium-x64.cc
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/src/crankshaft/x64/lithium-x64.h
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard0.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard1.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard2.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard3.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard4.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard5.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard6.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard7.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard8.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest-shard9.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-megatest.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call-simple.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/es6/tail-call.js
[modify] https://crrev.com/acbb968dedd2b02b5447215a579cf4cdc99bc69a/test/mjsunit/mjsunit.status

Comment 40 by bugdroid1@chromium.org, Mar 21 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/e6dca379b633682e64542c86ed68941ccca221f0

commit e6dca379b633682e64542c86ed68941ccca221f0
Author: ishell <ishell@chromium.org>
Date: Mon Mar 21 19:22:35 2016

[crankshaft] Check if the function is callable before generating a tail call via Call builtin.

This is necessary to ensure that "Called non callable" exception will get a proper message and stack trace even for calls at tail position.

BUG= chromium:595615 , v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34962}

[modify] https://crrev.com/e6dca379b633682e64542c86ed68941ccca221f0/src/crankshaft/hydrogen.cc
[modify] https://crrev.com/e6dca379b633682e64542c86ed68941ccca221f0/src/crankshaft/hydrogen.h
[add] https://crrev.com/e6dca379b633682e64542c86ed68941ccca221f0/test/mjsunit/regress/regress-crbug-595615.js

Comment 43 by bugdroid1@chromium.org, Mar 22 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/df694d552448bca451e4ffd406f5446bffb28fd2

commit df694d552448bca451e4ffd406f5446bffb28fd2
Author: ishell <ishell@chromium.org>
Date: Tue Mar 22 14:43:37 2016

[crankshaft] Support inlining of function calls in tail position (in ES6 sense).

BUG=v8:4698
LOG=N
TBR=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#34992}

[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/arm/lithium-arm.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/arm64/lithium-arm64.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/hydrogen-instructions.h
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/hydrogen.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/hydrogen.h
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/ia32/lithium-ia32.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/lithium-codegen.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/lithium.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/mips/lithium-mips.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/mips64/lithium-mips64.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/ppc/lithium-ppc.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/s390/lithium-s390.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/x64/lithium-x64.cc
[modify] https://crrev.com/df694d552448bca451e4ffd406f5446bffb28fd2/src/crankshaft/x87/lithium-x87.cc

Comment 44 by bugdroid1@chromium.org, Mar 22 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/a6bf5bbdeacb428e5dd4dc10d9446feea7dd4ac2

commit a6bf5bbdeacb428e5dd4dc10d9446feea7dd4ac2
Author: mbrandy <mbrandy@us.ibm.com>
Date: Tue Mar 22 16:37:01 2016

PPC: [crankshaft] Fixing ES6 tail call elimination.

Port acbb968dedd2b02b5447215a579cf4cdc99bc69a
Port 66e22b79e812437aa3be168da4612e64a2de6728

Original commit messages:
    In case when F inlined normal call to G which tail calls H we should not write translation for G for the tail call site.
    Otherwise we will see G in a stack trace inside H.

    This CL also enables all existing tests related to ES6 tail call elimination and adds more combinations.

    Always generate lazy bailout points for tail calls because Debugger could still require them to inspect optimized frames.

R=ishell@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG= chromium:596473 , v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34996}

[modify] https://crrev.com/a6bf5bbdeacb428e5dd4dc10d9446feea7dd4ac2/src/crankshaft/ppc/lithium-ppc.cc
[modify] https://crrev.com/a6bf5bbdeacb428e5dd4dc10d9446feea7dd4ac2/src/crankshaft/ppc/lithium-ppc.h

Comment 45 by bugdroid1@chromium.org, Mar 22 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/716ab0d3b40d52d45274e4c26702d1bbf448c20b

commit 716ab0d3b40d52d45274e4c26702d1bbf448c20b
Author: jyan <jyan@ca.ibm.com>
Date: Tue Mar 22 18:15:58 2016

S390: [crankshaft] Fixing ES6 tail call elimination.

Port acbb968dedd2b02b5447215a579cf4cdc99bc69a
Port 66e22b79e812437aa3be168da4612e64a2de6728

Original commit messages:
    In case when F inlined normal call to G which tail calls H we should not write translation for G for the tail call site.
    Otherwise we will see G in a stack trace inside H.

    This CL also enables all existing tests related to ES6 tail call elimination and adds more combinations.

    Always generate lazy bailout points for tail calls because Debugger could still require them to inspect optimized frames.

R=ishell@chromium.org, joransiu@ca.ibm.com, mbrandy@us.ibm.com, michael_dawson@ca.ibm.com
BUG= chromium:596473 , v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35003}

[modify] https://crrev.com/716ab0d3b40d52d45274e4c26702d1bbf448c20b/src/crankshaft/s390/lithium-s390.cc
[modify] https://crrev.com/716ab0d3b40d52d45274e4c26702d1bbf448c20b/src/crankshaft/s390/lithium-s390.h

Comment 46 by bugdroid1@chromium.org, Mar 22 2016

Project Member

Comment 47 by bugdroid1@chromium.org, Mar 29 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/7a33bd5da48f6b7abdeeb013df360f1af84c06b7

commit 7a33bd5da48f6b7abdeeb013df360f1af84c06b7
Author: ishell <ishell@chromium.org>
Date: Tue Mar 29 11:43:46 2016

[es6] Add a flag to the Isolate that defines whether ES2015 tail call elimination is enabled or not.

Thus DevTools will be able to disable tail call elimination dynamically upon user's choice.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35098}

[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/arm/builtins-arm.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/arm64/builtins-arm64.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/assembler.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/assembler.h
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/external-reference-table.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/ia32/builtins-ia32.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/isolate.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/isolate.h
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/mips/builtins-mips.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/mips64/builtins-mips64.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/ppc/builtins-ppc.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/s390/builtins-s390.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/x64/builtins-x64.cc
[modify] https://crrev.com/7a33bd5da48f6b7abdeeb013df360f1af84c06b7/src/x87/builtins-x87.cc

Comment 50 by kozyatinskiy@chromium.org, Mar 30 2016

Blocking: 599276

Comment 51 by bugdroid1@chromium.org, Apr 1 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4

commit ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4
Author: ishell <ishell@chromium.org>
Date: Fri Apr 01 07:22:22 2016

[crankshaft] [turbofan] Fix environment handling when generating a tail call from inlined function.

This CL ensures that we build environments/frame states so that tail caller frame will never become topmost.

BUG= chromium:598998 , v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35188}

[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/compiler/instruction-selector.cc
[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/crankshaft/arm/lithium-arm.cc
[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/crankshaft/arm64/lithium-arm64.cc
[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/crankshaft/ia32/lithium-ia32.cc
[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/crankshaft/mips/lithium-mips.cc
[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/crankshaft/mips64/lithium-mips64.cc
[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/crankshaft/ppc/lithium-ppc.cc
[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/crankshaft/s390/lithium-s390.cc
[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/crankshaft/x64/lithium-x64.cc
[modify] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/src/crankshaft/x87/lithium-x87.cc
[add] https://crrev.com/ecb8fcfcca4c35a32a8c10bf63dd090bdc5424c4/test/mjsunit/regress/regress-crbug-598998.js

Comment 52 by bugdroid1@chromium.org, Apr 4 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/3d4f85ab9f38340082519dea318bfe2ad967a5a5

commit 3d4f85ab9f38340082519dea318bfe2ad967a5a5
Author: yangguo <yangguo@chromium.org>
Date: Mon Apr 04 09:38:41 2016

[debugger] fix step-next for tail calls.

R=ishell@chromium.org
BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35230}

[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/arm64/assembler-arm64.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/assembler.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/assembler.h
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/debug/debug.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/debug/debug.h
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/arm/full-codegen-arm.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/arm64/full-codegen-arm64.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/full-codegen.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/full-codegen.h
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/ia32/full-codegen-ia32.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/mips/full-codegen-mips.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/mips64/full-codegen-mips64.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/ppc/full-codegen-ppc.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/s390/full-codegen-s390.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/x64/full-codegen-x64.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/full-codegen/x87/full-codegen-x87.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/mips/assembler-mips.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/src/mips64/assembler-mips64.cc
[modify] https://crrev.com/3d4f85ab9f38340082519dea318bfe2ad967a5a5/test/cctest/test-debug.cc

Comment 54 by bugdroid1@chromium.org, Apr 13 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/26c480d13c19e598103067576a05008319a7b7ac

commit 26c480d13c19e598103067576a05008319a7b7ac
Author: ishell <ishell@chromium.org>
Date: Mon Apr 11 12:19:23 2016

[deoptimizer] Extend assert to also expect kTailCallerFunction as bottommost frame when accessing arguments for inlined function.

BUG= chromium:601617 , v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35385}

[modify] https://crrev.com/26c480d13c19e598103067576a05008319a7b7ac/src/deoptimizer.cc
[add] https://crrev.com/26c480d13c19e598103067576a05008319a7b7ac/test/mjsunit/regress/regress-crbug-601617.js

Comment 55 by kozyatinskiy@chromium.org, Apr 13 2016

Blocking: -chromium:599276

Comment 56 by bugdroid1@chromium.org, Apr 14 2016

Project Member
Labels: merge-merged-5.1
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/1e1e59f5cf1c8b7e4152339016226b3d67281019

commit 1e1e59f5cf1c8b7e4152339016226b3d67281019
Author: ishell@chromium.org <ishell@chromium.org>
Date: Thu Apr 14 10:48:08 2016

Version 5.1.281.7 (cherry-pick)

Merged 26c480d13c19e598103067576a05008319a7b7ac

[deoptimizer] Extend assert to also expect kTailCallerFunction as bottommost frame when accessing arguments for inlined function.

BUG= chromium:601617 ,v8:4698
LOG=N
R=jarin@chromium.org

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

Cr-Commit-Position: refs/branch-heads/5.1@{#10}
Cr-Branched-From: 167dc63b4c9a1d0f0fe1b19af93644ac9a561e83-refs/heads/5.1.281@{#1}
Cr-Branched-From: 03953f52bd4a184983a551927c406be6489ef89b-refs/heads/master@{#35282}

[modify] https://crrev.com/1e1e59f5cf1c8b7e4152339016226b3d67281019/include/v8-version.h
[modify] https://crrev.com/1e1e59f5cf1c8b7e4152339016226b3d67281019/src/deoptimizer.cc
[add] https://crrev.com/1e1e59f5cf1c8b7e4152339016226b3d67281019/test/mjsunit/regress/regress-crbug-601617.js

Comment 57 by bugdroid1@chromium.org, Apr 21 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/b4dbb2f710834f37a0e6fbc5ea7c6d660d25c8b0

commit b4dbb2f710834f37a0e6fbc5ea7c6d660d25c8b0
Author: ishell <ishell@chromium.org>
Date: Thu Apr 21 09:53:06 2016

[deoptimizer] Do not modify stack_fp which is used as a key for lookup of previously materialized objects.

BUG= chromium:604680 , v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35693}

[modify] https://crrev.com/b4dbb2f710834f37a0e6fbc5ea7c6d660d25c8b0/src/deoptimizer.cc
[add] https://crrev.com/b4dbb2f710834f37a0e6fbc5ea7c6d660d25c8b0/test/mjsunit/regress/regress-crbug-604680.js

Comment 58 by bugdroid1@chromium.org, Apr 26 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/1ef876ea478a6bf3ddc0748625a5da3130436248

commit 1ef876ea478a6bf3ddc0748625a5da3130436248
Author: ishell@chromium.org <ishell@chromium.org>
Date: Tue Apr 26 08:40:32 2016

Version 5.1.281.17 (cherry-pick)

Merged b4dbb2f710834f37a0e6fbc5ea7c6d660d25c8b0

[deoptimizer] Do not modify stack_fp which is used as a key for lookup of previously materialized objects.

BUG= chromium:604680 ,v8:4698
LOG=N
R=jarin@chromium.org

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

Cr-Commit-Position: refs/branch-heads/5.1@{#21}
Cr-Branched-From: 167dc63b4c9a1d0f0fe1b19af93644ac9a561e83-refs/heads/5.1.281@{#1}
Cr-Branched-From: 03953f52bd4a184983a551927c406be6489ef89b-refs/heads/master@{#35282}

[modify] https://crrev.com/1ef876ea478a6bf3ddc0748625a5da3130436248/include/v8-version.h
[modify] https://crrev.com/1ef876ea478a6bf3ddc0748625a5da3130436248/src/deoptimizer.cc
[add] https://crrev.com/1ef876ea478a6bf3ddc0748625a5da3130436248/test/mjsunit/regress/regress-crbug-604680.js

Comment 60 by bugdroid1@chromium.org, Apr 27 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/813f2778f31e5f4cb07bc5c963e24bd3387c677e

commit 813f2778f31e5f4cb07bc5c963e24bd3387c677e
Author: ishell <ishell@chromium.org>
Date: Wed Apr 27 09:32:35 2016

[es6] Don't eliminate tail calls from for-in and for-of bodies.

BUG=v8:4698
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35813}

[modify] https://crrev.com/813f2778f31e5f4cb07bc5c963e24bd3387c677e/src/parsing/parser.cc
[modify] https://crrev.com/813f2778f31e5f4cb07bc5c963e24bd3387c677e/test/mjsunit/es6/tail-call.js

Comment 62 by bugdroid1@chromium.org, May 6 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197

commit e17a283f92c99d4ba7daee0dbb2e7d9e65b91197
Author: ishell <ishell@chromium.org>
Date: Fri May 06 12:36:23 2016

[es6] Properly handle the case when an inlined getter/setter/constructor does a tail call.

Deoptimizer is now able to reconstruct topmost accessor and constructor frames.

BUG= chromium:608278 , v8:4698
LOG=N
TBR=bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/1936043002
Cr-Commit-Position: refs/heads/master@{#36075}

[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/arm/lithium-arm.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/arm64/lithium-arm64.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/hydrogen-instructions.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/ia32/lithium-ia32.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/lithium.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/lithium.h
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/mips/lithium-mips.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/mips64/lithium-mips64.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/ppc/lithium-ppc.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/s390/lithium-s390.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/x64/lithium-x64.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/crankshaft/x87/lithium-x87.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/src/deoptimizer.cc
[modify] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/test/mjsunit/es6/tail-call.js
[add] https://crrev.com/e17a283f92c99d4ba7daee0dbb2e7d9e65b91197/test/mjsunit/regress/regress-crbug-608278.js

Comment 63 by bugdroid1@chromium.org, May 11 2016

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/b68332d0b5dd6e043daaeed6b7dc0f4761e72168

commit b68332d0b5dd6e043daaeed6b7dc0f4761e72168
Author: ishell@chromium.org <ishell@chromium.org>
Date: Wed May 11 08:19:43 2016

Version 5.1.281.32 (cherry-pick)

Merged e17a283f92c99d4ba7daee0dbb2e7d9e65b91197

[es6] Properly handle the case when an inlined getter/setter/constructor does a tail call.

BUG= chromium:608278 ,v8:4698
LOG=N
R=jarin@chromium.org

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

Cr-Commit-Position: refs/branch-heads/5.1@{#36}
Cr-Branched-From: 167dc63b4c9a1d0f0fe1b19af93644ac9a561e83-refs/heads/5.1.281@{#1}
Cr-Branched-From: 03953f52bd4a184983a551927c406be6489ef89b-refs/heads/master@{#35282}

[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/include/v8-version.h
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/arm/lithium-arm.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/arm64/lithium-arm64.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/hydrogen-instructions.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/ia32/lithium-ia32.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/lithium.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/lithium.h
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/mips/lithium-mips.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/mips64/lithium-mips64.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/ppc/lithium-ppc.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/s390/lithium-s390.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/x64/lithium-x64.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/crankshaft/x87/lithium-x87.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/src/deoptimizer.cc
[modify] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/test/mjsunit/es6/tail-call.js
[add] https://crrev.com/b68332d0b5dd6e043daaeed6b7dc0f4761e72168/test/mjsunit/regress/regress-crbug-608278.js

Comment 64 by littledan@chromium.org, Jun 21 2016

Components: Language

Comment 65 by littledan@chromium.org, Jun 22 2016

Labels: SpecViolation-OpenQuestion

Comment 66 by hablich@chromium.org, Sep 16 2016

Blocking: chromium:596437

Comment 67 by bugdroid1@chromium.org, Feb 11 2017

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/f1f610178f93d3e00cdef43311c893958c6fa2c0

commit f1f610178f93d3e00cdef43311c893958c6fa2c0
Author: adamk <adamk@chromium.org>
Date: Sat Feb 11 11:45:50 2017

Un-stage tail calls

This patch removes the implication from --harmony to --harmony-tailcalls.

R=ishell@chromium.org
BUG=v8:4698

Review-Url: https://codereview.chromium.org/2691483004
Cr-Commit-Position: refs/heads/master@{#43124}

[modify] https://crrev.com/f1f610178f93d3e00cdef43311c893958c6fa2c0/src/flag-definitions.h

Comment 68 by hablich@chromium.org, Mar 23 2017

Labels: Priority-2

Comment 69 by bugdroid1@chromium.org, Jul 13 2017

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/1769f892cef0822e6a8b5334e2ad909a0c33e906

commit 1769f892cef0822e6a8b5334e2ad909a0c33e906
Author: Adam Klein <adamk@chromium.org>
Date: Thu Jul 13 19:29:05 2017

[cleanup] Remove always-off support for tail calls

The tail call implementation is hidden behind the --harmony-tailcalls
flag, which is off-by-default (and has been unstaged since February).
It is known to be broken in a variety of cases, including clusterfuzz
security issues (see sample Chromium issues below). To avoid letting
the implementation bitrot further on trunk, this patch removes it.

Bug: v8:4698,  chromium:636914 ,  chromium:724746 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng;master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: I9cb547101456a582374fdf7b1a3f044a9ef33e5c
Reviewed-on: https://chromium-review.googlesource.com/569069
Commit-Queue: Adam Klein <adamk@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46651}
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/api.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/assembler.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/assembler.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/ast/ast.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/ast/ast.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/ast/prettyprinter.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/bootstrapper.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/arm/builtins-arm.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/arm64/builtins-arm64.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/builtins-call-gen.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/builtins-call.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/builtins-definitions.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/builtins-interpreter-gen.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/builtins-interpreter.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/builtins.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/ia32/builtins-ia32.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/mips/builtins-mips.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/mips64/builtins-mips64.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/builtins/x64/builtins-x64.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/code-factory.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/code-factory.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/code-stubs.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/code-stubs.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/ast-graph-builder.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/bytecode-graph-builder.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/bytecode-graph-builder.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/code-generator.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/frame-states.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/frame-states.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/instruction-selector.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/js-call-reducer.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/js-generic-lowering.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/js-inlining.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/js-inlining.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/js-operator.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/js-operator.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/compiler/js-typed-lowering.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/debug/debug.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/debug/debug.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/deoptimizer.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/deoptimizer.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/external-reference-table.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/flag-definitions.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/full-codegen/arm/full-codegen-arm.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/full-codegen/arm64/full-codegen-arm64.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/full-codegen/full-codegen.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/full-codegen/full-codegen.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/full-codegen/ia32/full-codegen-ia32.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/full-codegen/mips/full-codegen-mips.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/full-codegen/mips64/full-codegen-mips64.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/full-codegen/x64/full-codegen-x64.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/globals.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/interpreter/bytecode-array-builder.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/interpreter/bytecode-generator.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/interpreter/bytecodes.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/interpreter/interpreter-assembler.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/interpreter/interpreter-assembler.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/interpreter/interpreter-generator.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/interpreter/interpreter-intrinsics-generator.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/isolate.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/isolate.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/objects.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/parsing/parse-info.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/parsing/parse-info.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/parsing/parser-base.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/parsing/parser.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/parsing/parser.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/runtime/runtime-test.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/src/runtime/runtime.h
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/cctest/interpreter/test-interpreter.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/cctest/test-debug.cc
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/debugger/debug/es6/debug-stepin-tailcalls.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/debugger/debug/es6/debug-stepout-tailcalls.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/compiler/deopt-accessors5.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/compiler/deopt-accessors6.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/compiler/regress-628773.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard0.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard1.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard2.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard3.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard4.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard5.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard6.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard7.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard8.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest-shard9.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-megatest.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-proxies.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call-simple.js
[delete] https://crrev.com/415fd8d8d1060502ad52c095aa18cd05f75d3af5/test/mjsunit/es6/tail-call.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/mjsunit.status
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-593299.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-537444.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-593697-2.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-595615.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-598998.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-601617.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-604680.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-608278.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-648539.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-658691.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/mjsunit/regress/regress-crbug-685634.js
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/test262/test262.status
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/unittests/interpreter/bytecode-array-builder-unittest.cc
[modify] https://crrev.com/1769f892cef0822e6a8b5334e2ad909a0c33e906/test/unittests/interpreter/interpreter-assembler-unittest.cc

Comment 71 by bugdroid1@chromium.org, Jul 20 2017

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed

commit 99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed
Author: Michael Starzinger <mstarzinger@chromium.org>
Date: Thu Jul 20 07:53:59 2017

[turbofan] Remove support for JS-to-JS tail-call.

This removes support for dropping arguments adaptor frames as part of
the JSFunction-to-JSFunction tail-call mechanism. The need for having
dedicated {kArchTailCallJSFunctionFromJSFunction} instructions is gone.

R=bmeurer@chromium.org
BUG=v8:4698

Change-Id: Id3d35d06800bee68e06b9554c4315e6ad304de5f
Reviewed-on: https://chromium-review.googlesource.com/575975
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46782}
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/arm/code-generator-arm.cc
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/arm64/code-generator-arm64.cc
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/ia32/code-generator-ia32.cc
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/instruction-codes.h
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/instruction-scheduler.cc
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/instruction-selector.cc
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/instruction.h
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/mips/code-generator-mips.cc
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/mips64/code-generator-mips64.cc
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/ppc/code-generator-ppc.cc
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/s390/code-generator-s390.cc
[modify] https://crrev.com/99bbf7b743ec7a10876c59c20b1dc0f7b4ed49ed/src/compiler/x64/code-generator-x64.cc

Comment 72 by tj.crow...@farsightsoftware.com, Nov 9 2017

Does this activity from July mean that TCO is going to be shelved for the foreseeable future and/or forever (just a question, not a complaint), or is it just lower on the list relative to other P2 issues? (Or has no decision either way been taken yet, which would be understandable?)

Thanks. -- T.J.

Comment 73 by adamk@chromium.org, Nov 9 2017

As the Chrome Platform Status page for this feature states (https://www.chromestatus.com/feature/5516876633341952), there's no active development of this feature in V8, due largely to the concerns laid out in the "Proper Tail Calls" section of this blog post: https://v8project.blogspot.com/2016/04/es6-es7-and-beyond.html.

Comment 74 by tj.crow...@farsightsoftware.com, Nov 10 2017

@adamk: Thanks. I wouldn't have expected the Chrome Platform Status page to be where this would be indicated. When I read that (and I had), I figured it mean Chrome was doing nothing until V8 did something.

But again: No active development _now_ or for the foreseeable future? The [proposal for a syntactic flag on tail calls][1] mentioned in that blog post is currently on the list of ["inactive" proposals][2].

Just trying to get a clear picture, if there is one, whether TCO is "dead" in V8 barring movement on that proposal, just delayed with no active development at present, or if that decision hasn't been taken.

Thanks -- T.J.

[1]: https://github.com/tc39/proposal-ptc-syntax
[2]: https://github.com/tc39/proposals/blob/master/inactive-proposals.md

Comment 75 by adamk@chromium.org, Nov 10 2017

Blocking: -chromium:596437
Cc: ishell@chromium.org
Labels: -Type-Bug -Hotlist-test262 -Hotlist-Burndown -merge-merged-5.1 -SpecViolation-OpenQuestion -Priority-2 SpecViolation-Backlog Priority-3 Type-FeatureRequest
Owner: adamk@chromium.org
For future reference, V8 indeed uses chromestatus.com to track its work on ECMAScript features.

It's hard to predict the future, but we currently have no plans to do work on tail calls in V8, for the reasons stated in the blog post (and the subsequent inactivity of the syntactic proposal).

Comment 76 by biohazar...@gmail.com, Nov 10 2017

So, spec is unimplementable, and all vendors except Apple are silently refusing to either implement it OR change the spec. What should actually happen to move this anywhere?

Comment 77 by adamk@chromium.org, Nov 10 2017

This is not a good place to discuss the spec. Suggested forums:

- Send email to es-discuss (https://mail.mozilla.org/listinfo/es-discuss)
- Ask on the #tc39 channel on irc.freenode.net
- File an issue at https://github.com/tc39/ecma262

Thanks for your understanding.

Comment 78 by tj.crow...@farsightsoftware.com, Nov 10 2017

@adamk: Many thanks! That's very useful. And absolutely, this isn't where discussion should happen. Thanks also for the Chrome Platform Status info. Best -- T.J.

Comment 79 by jon.ronn...@gmail.com, Nov 10 2017

@tj et al. Please post a link, if you take this discussion elsewhere. We are a lot who follow this bug with interest.

Comment 80 by b...@yisup.com, Jan 16 2018

I specifically write functional JavaScript code that relies on proper tails calls. I am stuck using Node 6 to do it. Not implementing this feature is about politics, not technical difficulty. Actually, it's been implemented. This isn't a defect really. It's just a refusal to follow the spec.

Comment 81 by kaizhu...@gmail.com, Sep 27

added web-compat bug @ https://bugs.chromium.org/p/v8/issues/detail?id=8234 that might be related

Comment 82 by shanonja...@gmail.com, Feb 5

It's actually extremely frustrating that this still isn't past the feature-flag stage and in live chrome. The specification for javascript approved this change when will the chrome team put their personal beliefs aside and implement javascript as the spec outlines.

Comment 83 by jon.ronn...@gmail.com, Feb 6

Unfortunately there was a strong belief that the stack trace would be
unreliable. This is however a misnomer as it is only recursive (and co
recursive) functions that would lack stack trace, which is very desirable,
because a stack trace of thousands of same function calls are useless
anyway.

If you could please convince front end engineers in their wrong
assumption... I for one would do a happy dance. But so far only ignorence
have prevailed.

Comment 84 by sanderel...@gmail.com, Feb 6

I would love to embrace a more functional style of programming, but missing out on this specced (es2015) feature is blocking me.

AFAIK there were some concerns around speed. Those should have evaporated by now. Once this is implemented, not having to manage a stack should be faster, right?

There was also an issue that you could not render stack-traces inside recursive functions. As Jon mentioned, that is actually a plus, not a downside. As long as the functions name is mentioned in the stack it's ok. perhaps just put the first iteration on the stack? and when it calls out to another recursive function do the same? Adding a marker so one can see it's call tail optimized function?

Let 2019 be the year where V8 becomes 100% spec compliant :)

Comment 85 by bmeu...@chromium.org, Feb 6

Re #83: This is not true. Any tail call site in any strict mode function will be affected, i.e. in case of

```js
"use strict";

function foo() { return bar(); }
function bar() { throw new Error; }

foo();
```

the stack trace would indicate that bar is called from top level.

Comment 86 by sanderel...@gmail.com, Feb 6

Re #85: Is the stack so tangled with tracing that it is impossible to push the foo function in the trace, but not on the stack?

Comment 87 by bmeu...@chromium.org, Feb 6

What do you mean? The stack trace is just that, a trace of the current execution stack. So whatever get's removed from the stack (via tail calls) has no chance of showing up on a trace of said stack later.

Ideas like shadow stacks have been discussed a lot in this context, but this would have to be on in production all the time, and so it'll eat additional resources even if you never throw an exception, since production time is the most important time here, as you'll need to make sense of the Error.stack's in your logfile to do any kind of post-mortem debugging (both client and server side).

Comment 88 by sanderel...@gmail.com, Feb 6

hmm, ok so a call tail optimized function needs still to be on the stack
then. Can the optimization kick in on the second iteration?
What I mean is everything processes as usual.  Then I hit a CTO function.
when this happens I look if the current function is already on the stack,
if not add it, otherwise just progress without pushing additional traces.
I'm pretty sure that is a very oversimplified way of putting it, Still, it
seems the logical thing to do to me.
Also, only CTO functions will pay this cost, and not the rest of the
runtime. Also, the cost will be lessened by the fact that we don't need to
manage the start after the first iteration.
I know this is not 100% CTO, but it gets really close and will lift the
current limitation on recursive programming

Op wo 6 feb. 2019 om 08:27 schreef bmeu… via monorail <
monorail+v2.824767423@chromium.org>:

Comment 89 by bmeu...@chromium.org, Feb 6

There are various different hacks how to go about this, all of them come with their own obstacles and drawbacks. A lot of thought went into this already on our side.

The real problem though is the spec and the fact that it hijacked tail call sites in strict mode functions and gave those new semantics in ES6. This essentially makes proper tail calls an "opt out" feature (aka a "footgun") in ES6. With a tiny spec change this could be turned into an "opt in" feature (i.e. with special syntax for tail calls), and then it would probably be straight-forward to ship this.

Comment 90 by e...@barzilay.org, Feb 6

Make a shadow stack; put it behind a flag so people can turn it on when they think they need it; see how usage of that flag dwindles away into nothingness as the fog of FUD disappears; remove the shadow stack.

That, or let ignorance prevail, as said above.

Comment 91 by sanderel...@gmail.com, Feb 6

Re: 89, I know. I have discussed this issue before IRL with some of you. I
just hoped some of the issues had been elevated by now.
Special syntax for this feature would be a boon, as that would make much
more clear to the programmer what's going on.
However, I'm not seeing any activity on this either in TC39.  IIRC there is
a proposal for this that's stalled on stage 0/1?
(I hope I missed something and there is a boatload of activity!)
Is there something I can do to get that moving again?

I love JS. A more functional way of programming is within reach, but the
current state of affairs is blocking truly embracing this.

Op wo 6 feb. 2019 om 09:13 schreef e… via monorail <
monorail+v2.3921524156@chromium.org>:

Comment 92 by bmeu...@chromium.org, Feb 6

Labels: HW-All
TBH I haven't looked closely into why the syntax proposals have been blocked by the committee, so I cannot really comment on that. It seems like someone really has to pick it up from here and get everyone in a room to come to an agreement, and then we can implement that proposal.

Comment 93 by adamk@chromium.org, Feb 6

As for "personal beliefs", it's not personal beliefs that are keeping V8 from implementing tail calls, but rather something of a stale-mate at TC39 (V8 is not the only engine represented there that objects to implicit tail call syntax, and would prefer explicit syntax).

That said, V8's issue tracker isn't the right place for that spec discussion. If you'd like to engage with the spec, https://github.com/tc39/ecma262/issues/535 is probably the best place to do so, currently.

Comment 94 by e...@barzilay.org, Feb 6

As long as there are no real facts, this *is* a "personal belief" thing.
Example from https://bugs.chromium.org/p/chromium/issues/detail?id=568695#c17,
abbreviated:

pfeldman: TCO pretty much kills debugging (and profiling) and brings no
value to the average user.

me: Do you *truly* believe that [this is] some conspiracy to "kill
debugging and profiling"...?

pfeldman: I have no better explanation :)

This is just a belief, and its from someone @chromium.org.  If there is
anything close to *facts*, it would be safari adding tail calls, and the
world not breaking as a result.  (I couldn't even find one place where
someone complains about it.)

========

You're pointing to the explicit syntax proposal, which is a bad idea.
I've described it in the last bullet of my reply at
https://github.com/tc39/proposal-ptc-syntax/issues/23#issuecomment-386972698
-- but a more explicit explanation: tail call elimination at the level
of my own code is one side of the problem which I can resolve all by my
lonesome (eg, by using loops).  The other side is when such tail calls
go through some higher-order third-party library code.  When *that*
happens, and I implement something that should be a functional loop but
I depend on that library (eg, a loop that goes through some promise
mechanics), then I could ask the author to please add "continue"
everywhere.  Given the current FUD, a likely answer is "no", and then I
get stuck, or I fork that library in the best tradition of piling
messes.

And as if to ensure that the above scenario does happen, that proposal
chooses a looooong keyword.  (Also useful to deter random bypassers from
accidentally using this mysterious academic trick that we don't know
much about.)  My personal belief (yes, really) is that this *will* be
real disaster, since it will result in a world where people would
conveniently say "you see, we made it possible for you freaks to get
tail calls, and nobody used them, now go away".

========

Finally, I find it dubious that the common line here is "it's not just
us".  Any random search for "chrome market share" will tell you why.

Comment 95 by biohazar...@gmail.com, Feb 7

#93 If that should be solved at TC39 level, why isn't google actively participating in that issue? Send some of your devrels or TC39 members there to resolve current blockers and work on the proposal. As #94 pointed out, given chrome market share, you guys can make a real impact there.

Comment 96 by adamk@chromium.org, Feb 7

Google is actively participating (I am the primary V8/Google representative), both on the tail call issue in particular and in TC39 in general. We also have devrel folks involved. It just so happens that this is not an easy matter to resolve.

Sign in to add a comment