Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1777)

Unified Diff: test/mjsunit/es6/tail-call-simple.js

Issue 1760253003: [crankshaft] Support ES6 tail call elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@tco-crank-2
Patch Set: Addressing comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/es6/tail-call-megatest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/tail-call-simple.js
diff --git a/test/mjsunit/es6/tail-call-simple.js b/test/mjsunit/es6/tail-call-simple.js
index d2890b0212d92044dd0099cdd4f24859d505dc98..5e4025bc5a20206bd651e3253ecda3f571af4154 100644
--- a/test/mjsunit/es6/tail-call-simple.js
+++ b/test/mjsunit/es6/tail-call-simple.js
@@ -3,6 +3,8 @@
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-tailcalls --stack-size=100
+// TODO(v8:4698), TODO(ishell): support these cases.
+// Flags: --no-turbo --nostress-opt
//
// Tail calls work only in strict mode.
@@ -10,7 +12,7 @@
(function() {
function f(n) {
if (n <= 0) {
- return "foo";
+ return "foo";
}
return f(n - 1);
}
@@ -27,7 +29,7 @@
"use strict";
function f(n) {
if (n <= 0) {
- return "foo";
+ return "foo";
}
return f(n - 1);
}
@@ -39,6 +41,20 @@
(function() {
"use strict";
+ function f(n) {
+ if (n <= 0) {
+ return "foo";
+ }
+ return f(n - 1, 42); // Call with arguments adaptor.
+ }
+ assertEquals("foo", f(1e5));
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals("foo", f(1e5));
+})();
+
+
+(function() {
+ "use strict";
function f(n){
if (n <= 0) {
return "foo";
@@ -59,6 +75,28 @@
})();
+(function() {
+ "use strict";
+ function f(n){
+ if (n <= 0) {
+ return "foo";
+ }
+ return 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.
+ }
+ assertEquals("foo", f(1e5));
+ assertEquals("bar", f(1e5 + 1));
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals("foo", f(1e5));
+ assertEquals("bar", f(1e5 + 1));
+})();
+
+
//
// Tail call bound functions.
//
« no previous file with comments | « test/mjsunit/es6/tail-call-megatest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698