[JSC] AI should not propagate AbstractValue relying on constant folding phase
[WebKit-https.git] / JSTests / microbenchmarks / poly-proto-and-non-poly-proto-same-ic.js
1 function assert(b, m) {
2     if (!b)
3         throw new Error("Bad:" + m);
4 }
5
6 function foo() {
7     class C {
8         constructor() {
9             this.p0 = 0
10             this.p1 = 1
11             this.p2 = 2
12             this.p3 = 3
13             this.p4 = 4
14             this.p5 = 5
15             this.p6 = 6
16             this.p7 = 7
17             this.p8 = 8
18             this.p9 = 9
19             this.p10 = 10
20             this.p11 = 11
21             this.p12 = 12
22             this.p13 = 13
23             this.p14 = 14
24             this.p15 = 15
25             this.p16 = 16
26             this.p17 = 17
27             this.p18 = 18
28             this.p19 = 19
29             this.p20 = 20
30             this.p21 = 21
31             this.p22 = 22
32             this.p23 = 23
33             this.p24 = 24
34             this.p25 = 25
35             this.p26 = 26
36             this.p27 = 27
37             this.p28 = 28
38             this.p29 = 29
39             this.p30 = 30
40             this.p31 = 31
41             this.p32 = 32
42             this.p33 = 33
43             this.p34 = 34
44             this.p35 = 35
45             this.p36 = 36
46             this.p37 = 37
47             this.p38 = 38
48             this.p39 = 39
49         }
50     };
51
52     return new C;
53 }
54
55 let items = [];
56 for (let i = 0; i < 15; ++i) {
57     items.push(foo());
58 }
59
60 function validate() {
61     for (let i = 0; i < items.length; ++i) {
62         item = items[i];
63         assert(item.p0 === 0)
64         assert(item.p1 === 1)
65         assert(item.p2 === 2)
66         assert(item.p3 === 3)
67         assert(item.p4 === 4)
68         assert(item.p5 === 5)
69         assert(item.p6 === 6)
70         assert(item.p7 === 7)
71         assert(item.p8 === 8)
72         assert(item.p9 === 9)
73         assert(item.p10 === 10)
74         assert(item.p11 === 11)
75         assert(item.p12 === 12)
76         assert(item.p13 === 13)
77         assert(item.p14 === 14)
78         assert(item.p15 === 15)
79         assert(item.p16 === 16)
80         assert(item.p17 === 17)
81         assert(item.p18 === 18)
82         assert(item.p19 === 19)
83         assert(item.p20 === 20)
84         assert(item.p21 === 21)
85         assert(item.p22 === 22)
86         assert(item.p23 === 23)
87         assert(item.p24 === 24)
88         assert(item.p25 === 25)
89         assert(item.p26 === 26)
90         assert(item.p27 === 27)
91         assert(item.p28 === 28)
92         assert(item.p29 === 29)
93         assert(item.p30 === 30)
94         assert(item.p31 === 31)
95         assert(item.p32 === 32)
96         assert(item.p33 === 33)
97         assert(item.p34 === 34)
98         assert(item.p35 === 35)
99         assert(item.p36 === 36)
100         assert(item.p37 === 37)
101         assert(item.p38 === 38)
102         assert(item.p39 === 39)
103     }
104 }
105
106 let start = Date.now();
107 for (let i = 0; i < 10000; ++i)
108     validate();
109
110 if (false)
111     print(Date.now() - start);