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

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

Issue 1928203002: [es8] More spec compliant syntactic tail calls implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Some STC tests ported for PTC Created 4 years, 7 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/message/syntactic-tail-call-without-return.out ('k') | test/mjsunit/es7/syntactic-tail-call.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/tail-call.js
diff --git a/test/mjsunit/es6/tail-call.js b/test/mjsunit/es6/tail-call.js
index d3e35d6e1cc73253f44d267772a3431d0ceba946..33d737377d167c8adbf19fdc2ad82a6639093276 100644
--- a/test/mjsunit/es6/tail-call.js
+++ b/test/mjsunit/es6/tail-call.js
@@ -3,6 +3,8 @@
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-tailcalls
+// Flags: --harmony-do-expressions
+
"use strict";
Error.prepareStackTrace = (error,stack) => {
@@ -235,10 +237,57 @@ function f_153(expected_call_stack, a) {
return f([f, g3, test], 13), f([f, test], 153);
}
+ function g4(a) {
+ return f([f, g4, test], false) ||
+ (f([f, g4, test], true) && f([f, test], true));
+ }
+
+ function g5(a) {
+ return f([f, g5, test], true) &&
+ (f([f, g5, test], false) || f([f, test], true));
+ }
+
+ function g6(a) {
+ return f([f, g6, test], 13), f([f, g6, test], 42),
+ f([f, test], 153);
+ }
+
+ function g7(a) {
+ return f([f, g7, test], false) ||
+ (f([f, g7, test], false) ? f([f, test], true)
+ : f([f, test], true));
+ }
+
+ function g8(a) {
+ return f([f, g8, test], false) || f([f, g8, test], true) &&
+ f([f, test], true);
+ }
+
+ function g9(a) {
+ return f([f, g9, test], true) && f([f, g9, test], false) ||
+ f([f, test], true);
+ }
+
+ function g10(a) {
+ return f([f, g10, test], true) && f([f, g10, test], false) ||
+ f([f, g10, test], true) ?
+ f([f, g10, test], true) && f([f, g10, test], false) ||
+ f([f, test], true) :
+ f([f, g10, test], true) && f([f, g10, test], false) ||
+ f([f, test], true);
+ }
+
function test() {
assertEquals(true, g1());
assertEquals(true, g2());
assertEquals(153, g3());
+ assertEquals(true, g4());
+ assertEquals(true, g5());
+ assertEquals(153, g6());
+ assertEquals(true, g7());
+ assertEquals(true, g8());
+ assertEquals(true, g9());
+ assertEquals(true, g10());
}
test();
test();
@@ -450,9 +499,34 @@ function f_153(expected_call_stack, a) {
return (() => f_153([f_153, test]))();
}
+ function g3(a) {
+ var closure = () => f([f, closure, test], true)
+ ? f_153([f_153, test])
+ : f_153([f_153, test]);
+ return closure();
+ }
+
function test() {
assertEquals(153, g1());
assertEquals(153, g2());
+ assertEquals(153, g3());
+ }
+ test();
+ test();
+ %OptimizeFunctionOnNextCall(test);
+ test();
+})();
+
+
+// Test tail calls from do expressions.
+(function () {
+ function g1(a) {
+ var a = do { return f_153([f_153, test]); 42; };
+ return a;
+ }
+
+ function test() {
+ assertEquals(153, g1());
}
test();
test();
« no previous file with comments | « test/message/syntactic-tail-call-without-return.out ('k') | test/mjsunit/es7/syntactic-tail-call.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698