OLD | NEW |
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: --min-preparse-length 1 --allow-natives-syntax | 5 // Flags: --min-preparse-length 1 --allow-natives-syntax --lazy-inner-functions |
6 | 6 |
7 // Test that the information on which variables to allocate in context doesn't | 7 // Test that the information on which variables to allocate in context doesn't |
8 // change when recompiling. | 8 // change when recompiling. |
9 | 9 |
10 (function TestVarInInnerFunction() { | 10 (function TestVarInInnerFunction() { |
11 // Introduce variables which would potentially be context allocated, depending | 11 // Introduce variables which would potentially be context allocated, depending |
12 // on whether an inner function refers to them or not. | 12 // on whether an inner function refers to them or not. |
13 var a = 1; | 13 var a = 1; |
14 var b = 2; | 14 var b = 2; |
15 var c = 3; | 15 var c = 3; |
(...skipping 27 matching lines...) Expand all Loading... |
43 for (var i = 0; i < 3; ++i) { | 43 for (var i = 0; i < 3; ++i) { |
44 if (i == 1) { | 44 if (i == 1) { |
45 %OptimizeOsr(); | 45 %OptimizeOsr(); |
46 } | 46 } |
47 assertEquals(1, a); | 47 assertEquals(1, a); |
48 assertEquals(2, b); | 48 assertEquals(2, b); |
49 assertEquals(3, c); | 49 assertEquals(3, c); |
50 } | 50 } |
51 })(); | 51 })(); |
52 | 52 |
| 53 (function TestConstInInnerFunction() { |
| 54 var a = 1; |
| 55 var b = 2; |
| 56 var c = 3; |
| 57 function inner() { |
| 58 const a = 0; |
| 59 a; b; c; |
| 60 } |
| 61 for (var i = 0; i < 3; ++i) { |
| 62 if (i == 1) { |
| 63 %OptimizeOsr(); |
| 64 } |
| 65 assertEquals(1, a); |
| 66 assertEquals(2, b); |
| 67 assertEquals(3, c); |
| 68 } |
| 69 })(); |
| 70 |
53 (function TestInnerFunctionParameter() { | 71 (function TestInnerFunctionParameter() { |
54 var a = 1; | 72 var a = 1; |
55 var b = 2; | 73 var b = 2; |
56 var c = 3; | 74 var c = 3; |
57 function inner(a) { | 75 function inner(a) { |
58 a; b; c; | 76 a; b; c; |
59 } | 77 } |
60 for (var i = 0; i < 3; ++i) { | 78 for (var i = 0; i < 3; ++i) { |
61 if (i == 1) { | 79 if (i == 1) { |
62 %OptimizeOsr(); | 80 %OptimizeOsr(); |
63 } | 81 } |
64 assertEquals(1, a); | 82 assertEquals(1, a); |
65 assertEquals(2, b); | 83 assertEquals(2, b); |
66 assertEquals(3, c); | 84 assertEquals(3, c); |
67 } | 85 } |
68 })(); | 86 })(); |
69 | 87 |
| 88 (function TestInnerFunctionRestParameter() { |
| 89 var a = 1; |
| 90 var b = 2; |
| 91 var c = 3; |
| 92 function inner(...a) { |
| 93 a; b; c; |
| 94 } |
| 95 for (var i = 0; i < 3; ++i) { |
| 96 if (i == 1) { |
| 97 %OptimizeOsr(); |
| 98 } |
| 99 assertEquals(1, a); |
| 100 assertEquals(2, b); |
| 101 assertEquals(3, c); |
| 102 } |
| 103 })(); |
| 104 |
70 (function TestInnerInnerFunctionParameter() { | 105 (function TestInnerInnerFunctionParameter() { |
71 var a = 1; | 106 var a = 1; |
72 var b = 2; | 107 var b = 2; |
73 var c = 3; | 108 var c = 3; |
74 function inner() { | 109 function inner() { |
75 function innerinner(a) { a; b; c; } | 110 function innerinner(a) { a; b; c; } |
76 } | 111 } |
77 for (var i = 0; i < 3; ++i) { | 112 for (var i = 0; i < 3; ++i) { |
78 if (i == 1) { | 113 if (i == 1) { |
79 %OptimizeOsr(); | 114 %OptimizeOsr(); |
80 } | 115 } |
81 assertEquals(1, a); | 116 assertEquals(1, a); |
82 assertEquals(2, b); | 117 assertEquals(2, b); |
83 assertEquals(3, c); | 118 assertEquals(3, c); |
84 } | 119 } |
85 })(); | 120 })(); |
86 | 121 |
| 122 (function TestInnerInnerFunctionRestParameter() { |
| 123 var a = 1; |
| 124 var b = 2; |
| 125 var c = 3; |
| 126 function inner() { |
| 127 function innerinner(...a) { a; b; c; } |
| 128 } |
| 129 for (var i = 0; i < 3; ++i) { |
| 130 if (i == 1) { |
| 131 %OptimizeOsr(); |
| 132 } |
| 133 assertEquals(1, a); |
| 134 assertEquals(2, b); |
| 135 assertEquals(3, c); |
| 136 } |
| 137 })(); |
| 138 |
87 (function TestInnerArrowFunctionParameter() { | 139 (function TestInnerArrowFunctionParameter() { |
88 var a = 1; | 140 var a = 1; |
89 var b = 2; | 141 var b = 2; |
90 var c = 3; | 142 var c = 3; |
91 function inner() { | 143 function inner() { |
92 var f = a => a + b + c; | 144 var f = a => a + b + c; |
93 } | 145 } |
94 for (var i = 0; i < 3; ++i) { | 146 for (var i = 0; i < 3; ++i) { |
95 if (i == 1) { | 147 if (i == 1) { |
96 %OptimizeOsr(); | 148 %OptimizeOsr(); |
97 } | 149 } |
98 assertEquals(1, a); | 150 assertEquals(1, a); |
99 assertEquals(2, b); | 151 assertEquals(2, b); |
100 assertEquals(3, c); | 152 assertEquals(3, c); |
101 } | 153 } |
102 })(); | 154 })(); |
103 | 155 |
| 156 (function TestInnerArrowFunctionRestParameter() { |
| 157 var a = 1; |
| 158 var b = 2; |
| 159 var c = 3; |
| 160 function inner() { |
| 161 var f = (...a) => a + b + c; |
| 162 } |
| 163 for (var i = 0; i < 3; ++i) { |
| 164 if (i == 1) { |
| 165 %OptimizeOsr(); |
| 166 } |
| 167 assertEquals(1, a); |
| 168 assertEquals(2, b); |
| 169 assertEquals(3, c); |
| 170 } |
| 171 })(); |
| 172 |
104 (function TestInnerFunctionInnerFunction() { | 173 (function TestInnerFunctionInnerFunction() { |
105 var a = 1; | 174 var a = 1; |
106 var b = 2; | 175 var b = 2; |
107 var c = 3; | 176 var c = 3; |
108 function inner() { | 177 function inner() { |
109 function a() { } | 178 function a() { } |
110 a; b; c; | 179 a; b; c; |
111 } | 180 } |
112 for (var i = 0; i < 3; ++i) { | 181 for (var i = 0; i < 3; ++i) { |
113 if (i == 1) { | 182 if (i == 1) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 for (var i = 0; i < 3; ++i) { | 314 for (var i = 0; i < 3; ++i) { |
246 if (i == 1) { | 315 if (i == 1) { |
247 %OptimizeOsr(); | 316 %OptimizeOsr(); |
248 } | 317 } |
249 assertEquals(1, a); | 318 assertEquals(1, a); |
250 assertEquals(2, b); | 319 assertEquals(2, b); |
251 assertEquals(3, c); | 320 assertEquals(3, c); |
252 } | 321 } |
253 })(); | 322 })(); |
254 | 323 |
| 324 (function TestInnerFunctionDestructuring1() { |
| 325 var a = 1; |
| 326 var b = 2; |
| 327 var c = 3; |
| 328 function inner() { |
| 329 var [a, a2] = [1, 2]; |
| 330 a; b; c; |
| 331 } |
| 332 for (var i = 0; i < 3; ++i) { |
| 333 if (i == 1) { |
| 334 %OptimizeOsr(); |
| 335 } |
| 336 assertEquals(1, a); |
| 337 assertEquals(2, b); |
| 338 assertEquals(3, c); |
| 339 } |
| 340 })(); |
| 341 |
| 342 (function TestInnerFunctionDestructuring2() { |
| 343 var a = 1; |
| 344 var b = 2; |
| 345 var c = 3; |
| 346 function inner() { |
| 347 let [a, a2] = [1, 2]; |
| 348 a; b; c; |
| 349 } |
| 350 for (var i = 0; i < 3; ++i) { |
| 351 if (i == 1) { |
| 352 %OptimizeOsr(); |
| 353 } |
| 354 assertEquals(1, a); |
| 355 assertEquals(2, b); |
| 356 assertEquals(3, c); |
| 357 } |
| 358 })(); |
| 359 |
| 360 (function TestInnerFunctionDestructuring3() { |
| 361 var a = 1; |
| 362 var b = 2; |
| 363 var c = 3; |
| 364 function inner() { |
| 365 const [a, a2] = [1, 2]; |
| 366 a; b; c; |
| 367 } |
| 368 for (var i = 0; i < 3; ++i) { |
| 369 if (i == 1) { |
| 370 %OptimizeOsr(); |
| 371 } |
| 372 assertEquals(1, a); |
| 373 assertEquals(2, b); |
| 374 assertEquals(3, c); |
| 375 } |
| 376 })(); |
| 377 |
| 378 (function TestInnerFunctionDestructuring4() { |
| 379 var a = 1; |
| 380 var b = 2; |
| 381 var c = 3; |
| 382 function inner() { |
| 383 var [a2, ...a] = [1, 2]; |
| 384 a; b; c; |
| 385 } |
| 386 for (var i = 0; i < 3; ++i) { |
| 387 if (i == 1) { |
| 388 %OptimizeOsr(); |
| 389 } |
| 390 assertEquals(1, a); |
| 391 assertEquals(2, b); |
| 392 assertEquals(3, c); |
| 393 } |
| 394 })(); |
| 395 |
| 396 (function TestInnerFunctionDestructuring5() { |
| 397 var a = 1; |
| 398 var b = 2; |
| 399 var c = 3; |
| 400 function inner() { |
| 401 let [a2, ...a] = [1, 2]; |
| 402 a; b; c; |
| 403 } |
| 404 for (var i = 0; i < 3; ++i) { |
| 405 if (i == 1) { |
| 406 %OptimizeOsr(); |
| 407 } |
| 408 assertEquals(1, a); |
| 409 assertEquals(2, b); |
| 410 assertEquals(3, c); |
| 411 } |
| 412 })(); |
| 413 |
| 414 (function TestInnerFunctionDestructuring6() { |
| 415 var a = 1; |
| 416 var b = 2; |
| 417 var c = 3; |
| 418 function inner() { |
| 419 const [a2, ...a] = [1, 2]; |
| 420 a; b; c; |
| 421 } |
| 422 for (var i = 0; i < 3; ++i) { |
| 423 if (i == 1) { |
| 424 %OptimizeOsr(); |
| 425 } |
| 426 assertEquals(1, a); |
| 427 assertEquals(2, b); |
| 428 assertEquals(3, c); |
| 429 } |
| 430 })(); |
| 431 |
| 432 (function TestInnerFunctionDestructuring7() { |
| 433 var a = 1; |
| 434 var b = 2; |
| 435 var c = 3; |
| 436 function inner() { |
| 437 var {a, a2} = {a: 1, a2: 2}; |
| 438 a; b; c; |
| 439 } |
| 440 for (var i = 0; i < 3; ++i) { |
| 441 if (i == 1) { |
| 442 %OptimizeOsr(); |
| 443 } |
| 444 assertEquals(1, a); |
| 445 assertEquals(2, b); |
| 446 assertEquals(3, c); |
| 447 } |
| 448 })(); |
| 449 |
| 450 (function TestInnerFunctionDestructuring8() { |
| 451 var a = 1; |
| 452 var b = 2; |
| 453 var c = 3; |
| 454 function inner() { |
| 455 let {a, a2} = {a: 1, a2: 2}; |
| 456 a; b; c; |
| 457 } |
| 458 for (var i = 0; i < 3; ++i) { |
| 459 if (i == 1) { |
| 460 %OptimizeOsr(); |
| 461 } |
| 462 assertEquals(1, a); |
| 463 assertEquals(2, b); |
| 464 assertEquals(3, c); |
| 465 } |
| 466 })(); |
| 467 |
| 468 (function TestInnerFunctionDestructuring9() { |
| 469 var a = 1; |
| 470 var b = 2; |
| 471 var c = 3; |
| 472 function inner() { |
| 473 const {a, a2} = {a: 1, a2: 2}; |
| 474 a; b; c; |
| 475 } |
| 476 for (var i = 0; i < 3; ++i) { |
| 477 if (i == 1) { |
| 478 %OptimizeOsr(); |
| 479 } |
| 480 assertEquals(1, a); |
| 481 assertEquals(2, b); |
| 482 assertEquals(3, c); |
| 483 } |
| 484 })(); |
| 485 |
255 // A cluster of similar tests where the inner function only declares a variable | 486 // A cluster of similar tests where the inner function only declares a variable |
256 // whose name clashes with an outer function variable name, but doesn't use it. | 487 // whose name clashes with an outer function variable name, but doesn't use it. |
257 (function TestRegress650969_1() { | 488 (function TestRegress650969_1_var() { |
258 for (var i = 0; i < 3; ++i) { | 489 for (var i = 0; i < 3; ++i) { |
259 if (i == 1) { | 490 if (i == 1) { |
260 %OptimizeOsr(); | 491 %OptimizeOsr(); |
261 } | 492 } |
262 var a; | 493 var a; |
263 function inner() { | 494 function inner() { |
264 var a; | 495 var a; |
265 } | 496 } |
266 } | 497 } |
267 })(); | 498 })(); |
268 | 499 |
269 (function TestRegress650969_2() { | 500 (function TestRegress650969_1_let() { |
| 501 for (var i = 0; i < 3; ++i) { |
| 502 if (i == 1) { |
| 503 %OptimizeOsr(); |
| 504 } |
| 505 var a; |
| 506 function inner() { |
| 507 let a; |
| 508 } |
| 509 } |
| 510 })(); |
| 511 |
| 512 (function TestRegress650969_2_var() { |
270 for (var i = 0; i < 3; ++i) { | 513 for (var i = 0; i < 3; ++i) { |
271 if (i == 1) { | 514 if (i == 1) { |
272 %OptimizeOsr(); | 515 %OptimizeOsr(); |
273 } | 516 } |
274 var a; | 517 var a; |
275 function inner() { | 518 function inner() { |
276 var a = 6; | 519 var a = 6; |
277 } | 520 } |
278 } | 521 } |
279 })(); | 522 })(); |
280 | 523 |
281 (function TestRegress650969_3() { | 524 (function TestRegress650969_2_let() { |
| 525 for (var i = 0; i < 3; ++i) { |
| 526 if (i == 1) { |
| 527 %OptimizeOsr(); |
| 528 } |
| 529 var a; |
| 530 function inner() { |
| 531 let a = 6; |
| 532 } |
| 533 } |
| 534 })(); |
| 535 |
| 536 (function TestRegress650969_2_const() { |
| 537 for (var i = 0; i < 3; ++i) { |
| 538 if (i == 1) { |
| 539 %OptimizeOsr(); |
| 540 } |
| 541 var a; |
| 542 function inner() { |
| 543 const a = 6; |
| 544 } |
| 545 } |
| 546 })(); |
| 547 |
| 548 (function TestRegress650969_3_var() { |
282 for (var i = 0; i < 3; ++i) { | 549 for (var i = 0; i < 3; ++i) { |
283 if (i == 1) { | 550 if (i == 1) { |
284 %OptimizeOsr(); | 551 %OptimizeOsr(); |
285 } | 552 } |
286 var a; | 553 var a; |
287 function inner() { | 554 function inner() { |
288 var a, b; | 555 var a, b; |
289 } | 556 } |
290 } | 557 } |
291 })(); | 558 })(); |
292 | 559 |
293 (function TestRegress650969_4() { | 560 (function TestRegress650969_3_let() { |
294 for (var i = 0; i < 3; ++i) { | 561 for (var i = 0; i < 3; ++i) { |
295 if (i == 1) { | 562 if (i == 1) { |
296 %OptimizeOsr(); | 563 %OptimizeOsr(); |
297 } | |
298 var a; | |
299 function inner() { | |
300 var a = 6, b; | |
301 } | |
302 } | |
303 })(); | |
304 | |
305 (function TestRegress650969_5() { | |
306 for (var i = 0; i < 3; ++i) { | |
307 if (i == 1) { | |
308 %OptimizeOsr(); | |
309 } | |
310 var a; | |
311 function inner() { | |
312 let a; | |
313 } | |
314 } | |
315 })(); | |
316 | |
317 (function TestRegress650969_6() { | |
318 for (var i = 0; i < 3; ++i) { | |
319 if (i == 1) { | |
320 %OptimizeOsr(); | |
321 } | |
322 var a; | |
323 function inner() { | |
324 let a = 6; | |
325 } | |
326 } | |
327 })(); | |
328 | |
329 (function TestRegress650969_7() { | |
330 for (var i = 0; i < 3; ++i) { | |
331 if (i == 1) { | |
332 %OptimizeOsr(); | |
333 } | 564 } |
334 var a; | 565 var a; |
335 function inner() { | 566 function inner() { |
336 let a, b; | 567 let a, b; |
337 } | 568 } |
338 } | 569 } |
339 })(); | 570 })(); |
340 | 571 |
341 (function TestRegress650969_8() { | 572 (function TestRegress650969_4_var() { |
342 for (var i = 0; i < 3; ++i) { | 573 for (var i = 0; i < 3; ++i) { |
343 if (i == 1) { | 574 if (i == 1) { |
344 %OptimizeOsr(); | 575 %OptimizeOsr(); |
| 576 } |
| 577 var a; |
| 578 function inner() { |
| 579 var a = 6, b; |
| 580 } |
| 581 } |
| 582 })(); |
| 583 |
| 584 (function TestRegress650969_4_let() { |
| 585 for (var i = 0; i < 3; ++i) { |
| 586 if (i == 1) { |
| 587 %OptimizeOsr(); |
345 } | 588 } |
346 var a; | 589 var a; |
347 function inner() { | 590 function inner() { |
348 let a = 6, b; | 591 let a = 6, b; |
349 } | 592 } |
350 } | 593 } |
351 })(); | 594 })(); |
352 | 595 |
| 596 (function TestRegress650969_4_const() { |
| 597 for (var i = 0; i < 3; ++i) { |
| 598 if (i == 1) { |
| 599 %OptimizeOsr(); |
| 600 } |
| 601 var a; |
| 602 function inner() { |
| 603 const a = 0, b = 0; |
| 604 } |
| 605 } |
| 606 })(); |
| 607 |
353 (function TestRegress650969_9() { | 608 (function TestRegress650969_9() { |
354 for (var i = 0; i < 3; ++i) { | 609 for (var i = 0; i < 3; ++i) { |
355 if (i == 1) { | 610 if (i == 1) { |
356 %OptimizeOsr(); | 611 %OptimizeOsr(); |
357 } | 612 } |
358 var a; | 613 var a; |
359 function inner(a) { | 614 function inner(a) { |
360 } | 615 } |
361 } | 616 } |
362 })(); | 617 })(); |
| 618 |
| 619 (function TestRegress650969_10() { |
| 620 for (var i = 0; i < 3; ++i) { |
| 621 if (i == 1) { |
| 622 %OptimizeOsr(); |
| 623 } |
| 624 var a; |
| 625 function inner(...a) { |
| 626 } |
| 627 } |
| 628 })(); |
| 629 |
| 630 (function TestRegress650969_11_var() { |
| 631 for (var i = 0; i < 3; ++i) { |
| 632 if (i == 1) { |
| 633 %OptimizeOsr(); |
| 634 } |
| 635 var a; |
| 636 function inner() { |
| 637 var [a, b] = [1, 2]; |
| 638 } |
| 639 } |
| 640 })(); |
| 641 |
| 642 (function TestRegress650969_11_let() { |
| 643 for (var i = 0; i < 3; ++i) { |
| 644 if (i == 1) { |
| 645 %OptimizeOsr(); |
| 646 } |
| 647 var a; |
| 648 function inner() { |
| 649 let [a, b] = [1, 2]; |
| 650 } |
| 651 } |
| 652 })(); |
| 653 |
| 654 (function TestRegress650969_11_const() { |
| 655 for (var i = 0; i < 3; ++i) { |
| 656 if (i == 1) { |
| 657 %OptimizeOsr(); |
| 658 } |
| 659 var a; |
| 660 function inner() { |
| 661 const [a, b] = [1, 2]; |
| 662 } |
| 663 } |
| 664 })(); |
| 665 |
| 666 (function TestRegress650969_12_var() { |
| 667 for (var i = 0; i < 3; ++i) { |
| 668 if (i == 1) { |
| 669 %OptimizeOsr(); |
| 670 } |
| 671 var a; |
| 672 function inner() { |
| 673 var [b, a] = [1, 2]; |
| 674 } |
| 675 } |
| 676 })(); |
| 677 |
| 678 (function TestRegress650969_12_let() { |
| 679 for (var i = 0; i < 3; ++i) { |
| 680 if (i == 1) { |
| 681 %OptimizeOsr(); |
| 682 } |
| 683 var a; |
| 684 function inner() { |
| 685 let [b, a] = [1, 2]; |
| 686 } |
| 687 } |
| 688 })(); |
| 689 |
| 690 (function TestRegress650969_12_const() { |
| 691 for (var i = 0; i < 3; ++i) { |
| 692 if (i == 1) { |
| 693 %OptimizeOsr(); |
| 694 } |
| 695 var a; |
| 696 function inner() { |
| 697 const [b, a] = [1, 2]; |
| 698 } |
| 699 } |
| 700 })(); |
| 701 |
| 702 (function TestRegress650969_13_var() { |
| 703 for (var i = 0; i < 3; ++i) { |
| 704 if (i == 1) { |
| 705 %OptimizeOsr(); |
| 706 } |
| 707 var a; |
| 708 function inner() { |
| 709 var [b, ...a] = [1, 2]; |
| 710 } |
| 711 } |
| 712 })(); |
| 713 |
| 714 (function TestRegress650969_13_let() { |
| 715 for (var i = 0; i < 3; ++i) { |
| 716 if (i == 1) { |
| 717 %OptimizeOsr(); |
| 718 } |
| 719 var a; |
| 720 function inner() { |
| 721 let [b, ...a] = [1, 2]; |
| 722 } |
| 723 } |
| 724 })(); |
| 725 |
| 726 (function TestRegress650969_13_const() { |
| 727 for (var i = 0; i < 3; ++i) { |
| 728 if (i == 1) { |
| 729 %OptimizeOsr(); |
| 730 } |
| 731 var a; |
| 732 function inner() { |
| 733 const [b, ...a] = [1, 2]; |
| 734 } |
| 735 } |
| 736 })(); |
| 737 |
| 738 (function TestRegress650969_14_var() { |
| 739 for (var i = 0; i < 3; ++i) { |
| 740 if (i == 1) { |
| 741 %OptimizeOsr(); |
| 742 } |
| 743 var a; |
| 744 function inner() { |
| 745 var {a, b} = {a: 1, b: 2}; |
| 746 } |
| 747 } |
| 748 })(); |
| 749 |
| 750 (function TestRegress650969_14_let() { |
| 751 for (var i = 0; i < 3; ++i) { |
| 752 if (i == 1) { |
| 753 %OptimizeOsr(); |
| 754 } |
| 755 var a; |
| 756 function inner() { |
| 757 let {a, b} = {a: 1, b: 2}; |
| 758 } |
| 759 } |
| 760 })(); |
| 761 |
| 762 (function TestRegress650969_14_const() { |
| 763 for (var i = 0; i < 3; ++i) { |
| 764 if (i == 1) { |
| 765 %OptimizeOsr(); |
| 766 } |
| 767 var a; |
| 768 function inner() { |
| 769 const {a, b} = {a: 1, b: 2}; |
| 770 } |
| 771 } |
| 772 })(); |
| 773 |
| 774 (function TestRegress650969_15_var() { |
| 775 for (var i = 0; i < 3; ++i) { |
| 776 if (i == 1) { |
| 777 %OptimizeOsr(); |
| 778 } |
| 779 var a; |
| 780 function inner() { |
| 781 var {b: {a}, c} = {b: {a: 1}, c: 2}; |
| 782 } |
| 783 } |
| 784 })(); |
| 785 |
| 786 (function TestRegress650969_15_let() { |
| 787 for (var i = 0; i < 3; ++i) { |
| 788 if (i == 1) { |
| 789 %OptimizeOsr(); |
| 790 } |
| 791 var a; |
| 792 function inner() { |
| 793 let {b: {a}, c} = {b: {a: 1}, c: 2}; |
| 794 } |
| 795 } |
| 796 })(); |
| 797 |
| 798 (function TestRegress650969_15_const() { |
| 799 for (var i = 0; i < 3; ++i) { |
| 800 if (i == 1) { |
| 801 %OptimizeOsr(); |
| 802 } |
| 803 var a; |
| 804 function inner() { |
| 805 const {b: {a}, c} = {b: {a: 1}, c: 2}; |
| 806 } |
| 807 } |
| 808 })(); |
| 809 |
| 810 (function TestRegress650969_16_var() { |
| 811 for (var i = 0; i < 3; ++i) { |
| 812 if (i == 1) { |
| 813 %OptimizeOsr(); |
| 814 } |
| 815 var a; |
| 816 function inner() { |
| 817 var {a: {b}, c} = {a: {b: 1}, c: 2}; |
| 818 } |
| 819 } |
| 820 })(); |
| 821 |
| 822 (function TestRegress650969_16_let() { |
| 823 for (var i = 0; i < 3; ++i) { |
| 824 if (i == 1) { |
| 825 %OptimizeOsr(); |
| 826 } |
| 827 var a; |
| 828 function inner() { |
| 829 let {a: {b}, c} = {a: {b: 1}, c: 2}; |
| 830 } |
| 831 } |
| 832 })(); |
| 833 |
| 834 (function TestRegress650969_16_const() { |
| 835 for (var i = 0; i < 3; ++i) { |
| 836 if (i == 1) { |
| 837 %OptimizeOsr(); |
| 838 } |
| 839 var a; |
| 840 function inner() { |
| 841 const {a: {b}, c} = {a: {b: 1}, c: 2}; |
| 842 } |
| 843 } |
| 844 })(); |
| 845 |
| 846 (function TestRegress650969_17_var() { |
| 847 for (var i = 0; i < 3; ++i) { |
| 848 if (i == 1) { |
| 849 %OptimizeOsr(); |
| 850 } |
| 851 var a; |
| 852 function inner() { |
| 853 for (var a = 0; 0 == 1; ) { } |
| 854 } |
| 855 } |
| 856 })(); |
| 857 |
| 858 (function TestRegress650969_17_let() { |
| 859 for (var i = 0; i < 3; ++i) { |
| 860 if (i == 1) { |
| 861 %OptimizeOsr(); |
| 862 } |
| 863 var a; |
| 864 function inner() { |
| 865 for (let a = 0; 0 == 1; ) { } |
| 866 } |
| 867 } |
| 868 })(); |
| 869 |
| 870 (function TestRegress650969_17_const() { |
| 871 for (var i = 0; i < 3; ++i) { |
| 872 if (i == 1) { |
| 873 %OptimizeOsr(); |
| 874 } |
| 875 var a; |
| 876 function inner() { |
| 877 for (const a = 0; 0 == 1; ) { } |
| 878 } |
| 879 } |
| 880 })(); |
| 881 |
| 882 // Regression tests for an intermediate stage where unresolved references were |
| 883 // discarded too aggressively. |
| 884 (function TestRegress650969_sidetrack_var() { |
| 885 for (var i = 0; i < 3; ++i) { |
| 886 if (i == 1) { |
| 887 %OptimizeOsr(); |
| 888 } |
| 889 var a = 0; |
| 890 function inner() { |
| 891 return a; |
| 892 var {b: {a}, c} = {b: {a: 1}, c: 2}; |
| 893 } |
| 894 } |
| 895 })(); |
| 896 |
| 897 (function TestRegress650969_sidetrack_let() { |
| 898 for (var i = 0; i < 3; ++i) { |
| 899 if (i == 1) { |
| 900 %OptimizeOsr(); |
| 901 } |
| 902 var a = 0; |
| 903 function inner() { |
| 904 return a; |
| 905 let {b: {a}, c} = {b: {a: 1}, c: 2}; |
| 906 } |
| 907 } |
| 908 })(); |
| 909 |
| 910 (function TestRegress650969_sidetrack_const() { |
| 911 for (var i = 0; i < 3; ++i) { |
| 912 if (i == 1) { |
| 913 %OptimizeOsr(); |
| 914 } |
| 915 var a = 0; |
| 916 function inner() { |
| 917 return a; |
| 918 const {b: {a}, c} = {b: {a: 1}, c: 2}; |
| 919 } |
| 920 } |
| 921 })(); |
OLD | NEW |