Enable HAVE_AVFOUNDATION_VIDEO_OUTPUT on PLATFORM(IOSMAC)
[WebKit-https.git] / JSTests / controlFlowProfiler / arrowfunction-expression.js
1 load("./driver/driver.js");
2
3 var afSimple = y => y + 1,
4     afBlock = y => { y++; return y + 1;},
5     afBlockWithCondition = x => { x > 0 ? x++ : x--; return x;};
6
7 checkBasicBlock(afSimple, "y + 1", ShouldNotHaveExecuted);
8 afSimple(1);
9 checkBasicBlock(afSimple, "y + 1", ShouldHaveExecuted);
10
11
12 checkBasicBlock(afBlock, "y++", ShouldNotHaveExecuted);
13 afBlock(2);
14 checkBasicBlock(afBlock, "y++", ShouldHaveExecuted);
15 checkBasicBlock(afBlock, "return y + 1", ShouldHaveExecuted);
16
17
18 checkBasicBlock(afBlockWithCondition,'x++', ShouldNotHaveExecuted);
19 afBlockWithCondition(10);
20 checkBasicBlock(afBlockWithCondition,'x++', ShouldHaveExecuted);
21 checkBasicBlock(afBlockWithCondition,'return x', ShouldHaveExecuted);
22 checkBasicBlock(afBlockWithCondition,'x--', ShouldNotHaveExecuted);
23
24
25 afBlockWithCondition(-10);
26 checkBasicBlock(afBlockWithCondition,'x--', ShouldHaveExecuted);
27
28 function foo1(test) {
29    var f1 = () => { "hello"; }
30    if (test)
31        f1();
32 }
33 foo1(false);
34 checkBasicBlock(foo1, '() =>', ShouldNotHaveExecuted);
35 checkBasicBlock(foo1, '; }', ShouldNotHaveExecuted);
36 foo1(true);
37 checkBasicBlock(foo1, '() =>', ShouldHaveExecuted);
38 checkBasicBlock(foo1, '; }', ShouldHaveExecuted);
39
40 function foo2(test) {
41    var f1 = x => { "hello"; }
42    if (test)
43        f1();
44 }
45 foo2(false);
46 checkBasicBlock(foo2, 'x =>', ShouldNotHaveExecuted);
47 checkBasicBlock(foo2, '; }', ShouldNotHaveExecuted);
48 foo2(true);
49 checkBasicBlock(foo2, 'x =>', ShouldHaveExecuted);
50 checkBasicBlock(foo2, '; }', ShouldHaveExecuted);
51
52
53 function foo3(test) {
54    var f1 = (xyz) => { "hello"; }
55    if (test)
56        f1();
57 }
58 foo3(false);
59 checkBasicBlock(foo3, '(xyz) =>', ShouldNotHaveExecuted);
60 checkBasicBlock(foo3, '; }', ShouldNotHaveExecuted);
61 foo3(true);
62 checkBasicBlock(foo3, '(xyz) =>', ShouldHaveExecuted);
63 checkBasicBlock(foo3, '; }', ShouldHaveExecuted);