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

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

Issue 1914393002: [es6] Don't eliminate tail calls from for-in and for-of bodies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 | « src/parsing/parser.cc ('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.js
diff --git a/test/mjsunit/es6/tail-call.js b/test/mjsunit/es6/tail-call.js
index 318519b3551c0b939e9fdcbfef883c11c384708f..d3e35d6e1cc73253f44d267772a3431d0ceba946 100644
--- a/test/mjsunit/es6/tail-call.js
+++ b/test/mjsunit/es6/tail-call.js
@@ -247,6 +247,52 @@ function f_153(expected_call_stack, a) {
})();
+// Tail calling from various statements.
+(function() {
+ function g1() {
+ for (var v in {a:0}) {
+ return f_153([f_153, g1, test]);
+ }
+ }
+
+ function g2() {
+ for (var v of [1, 2, 3]) {
+ return f_153([f_153, g2, test]);
+ }
+ }
+
+ function g3() {
+ for (var i = 0; i < 10; i++) {
+ return f_153([f_153, test]);
+ }
+ }
+
+ function g4() {
+ while (true) {
+ return f_153([f_153, test]);
+ }
+ }
+
+ function g5() {
+ do {
+ return f_153([f_153, test]);
+ } while (true);
+ }
+
+ function test() {
+ assertEquals(153, g1());
+ assertEquals(153, g2());
+ assertEquals(153, g3());
+ assertEquals(153, g4());
+ assertEquals(153, g5());
+ }
+ test();
+ test();
+ %OptimizeFunctionOnNextCall(test);
+ test();
+})();
+
+
// Test tail calls from try-catch constructs.
(function() {
function tc1(a) {
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698