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

Side by Side Diff: test/mjsunit/es6/tail-call.js

Issue 2343823002: [parser] Fix tail calls in for in/of loops (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --allow-natives-syntax --harmony-tailcalls 5 // Flags: --allow-natives-syntax --harmony-tailcalls
6 // Flags: --harmony-do-expressions 6 // Flags: --harmony-do-expressions
7 7
8 "use strict"; 8 "use strict";
9 9
10 Error.prepareStackTrace = (error,stack) => { 10 Error.prepareStackTrace = (error,stack) => {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 %NeverOptimizeFunction(g); 289 %NeverOptimizeFunction(g);
290 290
291 function A() { 291 function A() {
292 this.x = 42; 292 this.x = 42;
293 return g(); 293 return g();
294 } 294 }
295 295
296 function test() { 296 function test() {
297 var o = new A(); 297 var o = new A();
298 %DebugPrint(o); 298 //%DebugPrint(o);
adamk 2016/09/15 15:48:53 Why was this here/why is it commented?
nickie 2016/09/15 16:01:33 Igor asked me to comment this out, while at this C
299 assertEquals(153, o.x); 299 assertEquals(153, o.x);
300 } 300 }
301 301
302 test(); 302 test();
303 test(); 303 test();
304 %OptimizeFunctionOnNextCall(test); 304 %OptimizeFunctionOnNextCall(test);
305 test(); 305 test();
306 })(); 306 })();
307 307
308 308
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 381
382 // Tail calling from various statements. 382 // Tail calling from various statements.
383 (function() { 383 (function() {
384 function g1() { 384 function g1() {
385 for (var v in {a:0}) { 385 for (var v in {a:0}) {
386 return f_153([f_153, g1, test]); 386 return f_153([f_153, g1, test]);
387 } 387 }
388 } 388 }
389 389
390 function g1let() {
391 for (let v in {a:0}) {
392 return f_153([f_153, g1let, test]);
393 }
394 }
395
396 function g1nodecl() {
397 var v;
398 for (v in {a:0}) {
399 return f_153([f_153, g1nodecl, test]);
400 }
401 }
402
390 function g2() { 403 function g2() {
391 for (var v of [1, 2, 3]) { 404 for (var v of [1, 2, 3]) {
392 return f_153([f_153, g2, test]); 405 return f_153([f_153, g2, test]);
393 } 406 }
394 } 407 }
395 408
409 function g2let() {
410 for (let v of [1, 2, 3]) {
411 return f_153([f_153, g2let, test]);
412 }
413 }
414
415 function g2nodecl() {
416 var v;
417 for (v of [1, 2, 3]) {
418 return f_153([f_153, g2nodecl, test]);
419 }
420 }
421
396 function g3() { 422 function g3() {
397 for (var i = 0; i < 10; i++) { 423 for (var i = 0; i < 10; i++) {
398 return f_153([f_153, test]); 424 return f_153([f_153, test]);
399 } 425 }
400 } 426 }
401 427
428 function g3let() {
429 for (let i = 0; i < 10; i++) {
430 return f_153([f_153, test]);
431 }
432 }
433
434 function g3nodecl() {
435 var i;
436 for (i = 0; i < 10; i++) {
437 return f_153([f_153, test]);
438 }
439 }
440
402 function g4() { 441 function g4() {
403 while (true) { 442 while (true) {
404 return f_153([f_153, test]); 443 return f_153([f_153, test]);
405 } 444 }
406 } 445 }
407 446
408 function g5() { 447 function g5() {
409 do { 448 do {
410 return f_153([f_153, test]); 449 return f_153([f_153, test]);
411 } while (true); 450 } while (true);
412 } 451 }
413 452
414 function test() { 453 function test() {
415 assertEquals(153, g1()); 454 assertEquals(153, g1());
455 assertEquals(153, g1let());
456 assertEquals(153, g1nodecl());
416 assertEquals(153, g2()); 457 assertEquals(153, g2());
458 assertEquals(153, g2let());
459 assertEquals(153, g2nodecl());
417 assertEquals(153, g3()); 460 assertEquals(153, g3());
461 assertEquals(153, g3let());
462 assertEquals(153, g3nodecl());
418 assertEquals(153, g4()); 463 assertEquals(153, g4());
419 assertEquals(153, g5()); 464 assertEquals(153, g5());
420 } 465 }
421 test(); 466 test();
422 test(); 467 test();
423 %OptimizeFunctionOnNextCall(test); 468 %OptimizeFunctionOnNextCall(test);
424 test(); 469 test();
425 })(); 470 })();
426 471
427 472
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 } 654 }
610 655
611 function test() { 656 function test() {
612 assertEquals(153, g1()); 657 assertEquals(153, g1());
613 } 658 }
614 test(); 659 test();
615 test(); 660 test();
616 %OptimizeFunctionOnNextCall(test); 661 %OptimizeFunctionOnNextCall(test);
617 test(); 662 test();
618 })(); 663 })();
OLDNEW
« 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