forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
while_stress_test.js
59 lines (53 loc) · 1.15 KB
/
while_stress_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// RUN: %hermes -hermes-parser -dump-ir %s
// In this test we generate the IR for interesting cases and make sure we don't crash.
// Check a few interesting combinations of lables, breaks and continues;
function lots_of_lables() {
foo0:
foo1:
foo2:
foo3:
foo4:
foo5:
foo6:
while (1) { break;
break foo0;
break foo6;
continue;
continue foo0;
continue foo6;
}
}
// Check a few interesting combinations of if/while control flow.
function nested_cfg() {
while (1) {
if (2) {
while(3) {
if (4) { continue; }
}
}
while(5) {
if (6) {
break;
}
}
}
}
// Check the nesting of while statements.
function high_nest_level(cond) {
label0: while (cond) {
label1: while (cond) {
label2: while (cond) {
label3: while (cond) {
label4: while (cond) {
label5: while (cond) {
if (cond) {
break label0;
}
} } } } } }
}