repo.or.cz
/
qtwebkit.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Update ReadMe.md
[qtwebkit.git]
/
JSTests
/
microbenchmarks
/
switch-constant.js
blob
9ea3e75db53c1f4c1bf0df7df6781610f14cf51a
1
function foo(o) {
2
switch (o.f) {
3
case 1: return 5;
4
case 2: return 2;
5
case 3: return 7;
6
case 4: return 9;
7
case 5: return o.f + 1;
8
case 6: return 0;
9
case 7: return 89;
10
case 8: return 23;
11
case 9: return 12;
12
case 10: return 54;
13
case 11: return 53;
14
default: return 42;
15
}
16
}
17
18
function bar() {
19
var result = 0;
20
for (var i = 0; i < 1000000; ++i)
21
result += foo({f:5});
22
return result;
23
}
24
25
var result = bar();
26
if (result != 6000000)
27
throw "Error: bad result: " + result;