]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/ftl-switch-string-slow-duplicate-cases.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / ftl-switch-string-slow-duplicate-cases.js
1 function foo(s) {
2 switch (s) {
3 case "ƑẦǏŁ":
4 case "ÌŅ":
5 case "ṤĻŐⱲ":
6 case "ṔÄȚĦ":
7 return 42;
8 case "due":
9 case "to":
10 case "16-bit":
11 case "strings":
12 return 43;
13 default:
14 return 44;
15 }
16 }
17
18 noInline(foo);
19
20 function cat(a, b) {
21 return a + b;
22 }
23
24 for (var i = 0; i < 10000; ++i) {
25 var result = foo(cat("16-", "bit"));
26 if (result != 43)
27 throw "Error: bad result (1): " + result;
28 result = foo("ƑẦǏŁ");
29 if (result != 42)
30 throw "Error: bad result (2): " + result;
31 }