| Index: test/mjsunit/es7/syntactic-tail-call-simple.js
|
| diff --git a/test/mjsunit/es6/tail-call-simple.js b/test/mjsunit/es7/syntactic-tail-call-simple.js
|
| similarity index 70%
|
| copy from test/mjsunit/es6/tail-call-simple.js
|
| copy to test/mjsunit/es7/syntactic-tail-call-simple.js
|
| index cc638082be592e953332cce27474daaecb68c2be..02f235e6d38230fe81ba9acd0b10e658de768846 100644
|
| --- a/test/mjsunit/es6/tail-call-simple.js
|
| +++ b/test/mjsunit/es7/syntactic-tail-call-simple.js
|
| @@ -2,34 +2,17 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// Flags: --allow-natives-syntax --harmony-tailcalls --stack-size=100
|
| -
|
| -//
|
| -// Tail calls work only in strict mode.
|
| -//
|
| -(function() {
|
| - function f(n) {
|
| - if (n <= 0) {
|
| - return "foo";
|
| - }
|
| - return f(n - 1);
|
| - }
|
| - assertThrows(()=>{ f(1e5) });
|
| - %OptimizeFunctionOnNextCall(f);
|
| - assertThrows(()=>{ f(1e5) });
|
| -})();
|
| -
|
| +// Flags: --allow-natives-syntax --harmony-explicit-tailcalls --stack-size=100
|
|
|
| //
|
| // Tail call normal functions.
|
| //
|
| (function() {
|
| - "use strict";
|
| function f(n) {
|
| if (n <= 0) {
|
| return "foo";
|
| }
|
| - return f(n - 1);
|
| + return continue f(n - 1);
|
| }
|
| assertEquals("foo", f(1e5));
|
| %OptimizeFunctionOnNextCall(f);
|
| @@ -38,12 +21,11 @@
|
|
|
|
|
| (function() {
|
| - "use strict";
|
| function f(n) {
|
| if (n <= 0) {
|
| return "foo";
|
| }
|
| - return f(n - 1, 42); // Call with arguments adaptor.
|
| + return continue f(n - 1, 42); // Call with arguments adaptor.
|
| }
|
| assertEquals("foo", f(1e5));
|
| %OptimizeFunctionOnNextCall(f);
|
| @@ -52,18 +34,17 @@
|
|
|
|
|
| (function() {
|
| - "use strict";
|
| function f(n){
|
| if (n <= 0) {
|
| return "foo";
|
| }
|
| - return g(n - 1);
|
| + return continue g(n - 1);
|
| }
|
| function g(n){
|
| if (n <= 0) {
|
| return "bar";
|
| }
|
| - return f(n - 1);
|
| + return continue f(n - 1);
|
| }
|
| assertEquals("foo", f(1e5));
|
| assertEquals("bar", f(1e5 + 1));
|
| @@ -74,18 +55,17 @@
|
|
|
|
|
| (function() {
|
| - "use strict";
|
| function f(n){
|
| if (n <= 0) {
|
| return "foo";
|
| }
|
| - return g(n - 1, 42); // Call with arguments adaptor.
|
| + return continue g(n - 1, 42); // Call with arguments adaptor.
|
| }
|
| function g(n){
|
| if (n <= 0) {
|
| return "bar";
|
| }
|
| - return f(n - 1, 42); // Call with arguments adaptor.
|
| + return continue f(n - 1, 42); // Call with arguments adaptor.
|
| }
|
| assertEquals("foo", f(1e5));
|
| assertEquals("bar", f(1e5 + 1));
|
| @@ -99,16 +79,15 @@
|
| // Tail call bound functions.
|
| //
|
| (function() {
|
| - "use strict";
|
| function f0(n) {
|
| if (n <= 0) {
|
| return "foo";
|
| }
|
| - return f_bound(n - 1);
|
| + return continue f_bound(n - 1);
|
| }
|
| var f_bound = f0.bind({});
|
| function f(n) {
|
| - return f_bound(n);
|
| + return continue f_bound(n);
|
| }
|
| assertEquals("foo", f(1e5));
|
| %OptimizeFunctionOnNextCall(f);
|
| @@ -117,23 +96,22 @@
|
|
|
|
|
| (function() {
|
| - "use strict";
|
| function f0(n){
|
| if (n <= 0) {
|
| return "foo";
|
| }
|
| - return g_bound(n - 1);
|
| + return continue g_bound(n - 1);
|
| }
|
| function g0(n){
|
| if (n <= 0) {
|
| return "bar";
|
| }
|
| - return f_bound(n - 1);
|
| + return continue f_bound(n - 1);
|
| }
|
| var f_bound = f0.bind({});
|
| var g_bound = g0.bind({});
|
| function f(n) {
|
| - return f_bound(n);
|
| + return continue f_bound(n);
|
| }
|
| assertEquals("foo", f(1e5));
|
| assertEquals("bar", f(1e5 + 1));
|
|
|