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

Unified Diff: test/mjsunit/tail-call-intrinsic.js

Issue 1455833004: [turbofan]: Implement tail calls with more callee than caller parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove stray change Created 5 years, 1 month 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
Index: test/mjsunit/tail-call-intrinsic.js
diff --git a/test/mjsunit/tail-call-intrinsic.js b/test/mjsunit/tail-call-intrinsic.js
index a74f153732c78de152ba7722f68188e2e609d6d7..771684f1ff29cc79d267eedffd4455115a814937 100644
--- a/test/mjsunit/tail-call-intrinsic.js
+++ b/test/mjsunit/tail-call-intrinsic.js
@@ -53,8 +53,8 @@ tailee3 = function(px) {
%OptimizeFunctionOnNextCall(tailee3);
assertEquals(p2, tailee3.call(p1, p2));
-// Ensure too many parameters defeats the tail call optimization (currently
-// unsupported).
+// Ensure too many parameters defeats the tail call optimization if they use the
+// arguments adapter (currently unsupported).
var count4 = 1000000;
tailee4 = function(px) {
"use strict";
@@ -106,3 +106,43 @@ tailee9 = function(px, py, pz, pa, pb, pc) {
%OptimizeFunctionOnNextCall(tailee8);
%OptimizeFunctionOnNextCall(tailee9);
assertEquals(32, tailee9.call(null, 15, 16, 17, 18, 0, 110));
+
+// Tail calls adding a single parameter.
+tailee10 = function(pb) {
+ return pb;
+}
+
+tailee11 = function() {
+ "use strict";
+ return %_TailCall(tailee10, this, 5);
+};
+
+%OptimizeFunctionOnNextCall(tailee10);
+%OptimizeFunctionOnNextCall(tailee11);
+assertEquals(5, tailee11.call(null));
+
+tailee12 = function(pa, pb, pc, pd) {
+ return pa + pb + pc + pd;
+}
+
+tailee13 = function(pa, pb) {
+ "use strict";
+ return %_TailCall(tailee12, 7, this, pb, pa, 13);
+};
+
+%OptimizeFunctionOnNextCall(tailee12);
+%OptimizeFunctionOnNextCall(tailee13);
+assertEquals(41, tailee13.call(12, 15, 1));
+
+tailee14 = function(pa, pb, pc, pd, pe, pf) {
+ return pa + pb + pc + pd + pe + pf;
+}
+
+tailee15 = function(pa, pb) {
+ "use strict";
+ return %_TailCall(tailee14, 7, this, pb, pa, 13, pb, pa);
+};
+
+%OptimizeFunctionOnNextCall(tailee14);
+%OptimizeFunctionOnNextCall(tailee15);
+assertEquals(57, tailee15.call(12, 15, 1));

Powered by Google App Engine
This is Rietveld 408576698