TCO is one of the ES6 proposals, and the proposal requires calls in "proper tail position" to get TCO'd. There is a benchmark here: http://jsperf.com/tco#chart=bar
Hi, in here is a discussion about how TCO makes possible to use constant stack space, so is important in the view of memory consumption. http://www.mega-nerd.com/erikd/Blog/CodeHacking/fp-tail-js.html
I have seen often extracts that look like the following: foo(); return; Do these count as "proper tail position"?
(In reply to David Rajchenbach Teller [:Yoric] from comment #2) > I have seen often extracts that look like the following: > > foo(); > return; > > Do these count as "proper tail position"? No, that's not a proper tail position, because it wouldn't be ok to just return whatever `foo()` returns. That extract must always return `undefined`.
OS: Windows 7 → All
Hardware: x86_64 → All
Summary: Harmony: Tail-call optimization in IonMonkey → ES6: Tail-call optimization in IonMonkey
WebKit is apparently the first widely used ES engine that supports proper tail call elimination: https://www.webkit.org/blog/4054/es6-in-webkit/
https://bugs.chromium.org/p/v8/issues/detail?id=4698 Chrome also is done.
More details on Webkit: https://webkit.org/blog/6240/ecmascript-6-proper-tail-calls-in-webkit/
You need to log in before you can comment on or make changes to this bug.