Commit Graph

13 Commits

Author SHA1 Message Date
nikolaos
d5dcce33bf [parser] Fix tail calls in for in/of loops
According to the ES6 specification, in "for in/of" loops like:

   for (var v of [1,2,3]) return f(...);

the call to f() should not be considered a tail call.  This was
not working properly, i.e., the case without declarations:

   var v;
   for (v of [1,2,3]) return f(...);

R=adamk@chromium.org, ishell@chromium.org
BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2343823002
Cr-Commit-Position: refs/heads/master@{#39497}
2016-09-19 09:47:56 +00:00
ishell
bcb1b8732a [es8] Throw SyntaxError when tail call expressions occur in non-strict mode.
BUG=v8:4915
LOG=N

Review-Url: https://codereview.chromium.org/1955393002
Cr-Commit-Position: refs/heads/master@{#36105}
2016-05-09 11:42:31 +00:00
ishell
e17a283f92 [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}
2016-05-06 12:37:13 +00:00
ishell
1350eb3dc9 [es8] More spec compliant syntactic tail calls implementation.
Unlike previous implementation where the 'continue' keyword was a feature of a return statement the keyword is now recognized as a part of expression. Error reporting was significantly improved.

--harmony-explicit-tailcalls option is now orthogonal to --harmony-tailcalls so we can test both modes at the same time.

This CL also adds %GetExceptionDetails(exception) that fetches hidden |start_pos| and |end_pos| values from the exception object.

BUG=v8:4915
LOG=N

Review-Url: https://codereview.chromium.org/1928203002
Cr-Commit-Position: refs/heads/master@{#36024}
2016-05-04 13:44:42 +00:00
ishell
813f2778f3 [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}
2016-04-27 09:34:10 +00:00
ishell
086fe2199b [es6] Fix tail call elimination in single-expression arrow functions.
BUG=v8:4698
LOG=Y

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

Cr-Commit-Position: refs/heads/master@{#35786}
2016-04-26 09:07:51 +00:00
ishell
acbb968ded [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}
2016-03-21 08:48:37 +00:00
machenbach
d64b41ded6 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}
2016-03-16 18:13:48 +00:00
ishell
689980f7d4 [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}
2016-03-16 17:06:41 +00:00
ishell
22938040fd [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}
2016-03-07 14:34:48 +00:00
ishell
c67b5096cd [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}
2016-02-18 10:13:20 +00:00
ishell
d12dbab466 [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}
2016-02-11 17:40:16 +00:00
ishell
6131ab1edd [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}
2016-01-26 11:07:40 +00:00