Enable HAVE_AVFOUNDATION_VIDEO_OUTPUT on PLATFORM(IOSMAC)
[WebKit-https.git] / JSTests / controlFlowProfiler / switch-statements.js
1 var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted;
2
3 load("./driver/driver.js");
4
5 var a, b, c;
6 function testSwitch(s) {
7     switch (s) {
8     case "foo":
9         return a;
10     case "bar":
11         return b;
12     default:
13         return c;
14     }
15 }
16
17 assert(!hasBasicBlockExecuted(testSwitch, "switch"), "should not have executed yet.");
18
19 testSwitch("foo");
20 assert(hasBasicBlockExecuted(testSwitch, "switch"), "should have executed.");
21 assert(hasBasicBlockExecuted(testSwitch, "return a"), "should have executed.");
22 assert(!hasBasicBlockExecuted(testSwitch, "return b"), "should not have executed yet.");
23 assert(!hasBasicBlockExecuted(testSwitch, "return c"), "should not have executed yet.");
24
25 testSwitch("bar");
26 assert(hasBasicBlockExecuted(testSwitch, "return b"), "should have executed.");
27 assert(!hasBasicBlockExecuted(testSwitch, "return c"), "should not have executed yet.");
28
29 testSwitch("");
30 assert(hasBasicBlockExecuted(testSwitch, "return c"), "should have executed.");