]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/test-spec-misc.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / test-spec-misc.js
CommitLineData
81345200
A
1var a = [ "String", false, 42 ];
2var count = 0;
3
4function getX(fromDFG) {
5 if (fromDFG)
6 return 42;
7 return false;
8}
9
10noInline(getX);
11
12function foo(index) {
13 var result = false;
14 var x = getX(DFGTrue());
15
16 x * 2;
17
18 var y = a[index % a.length];
19 result = y === x;
20 count += 1;
21 return result;
22}
23
24noInline(foo);
25
26var loopCount = 10000;
27
28function bar() {
29 var result;
30
31 for (var i = 0; i < loopCount - 1; i++)
32 result = foo(i)
33
34 result = foo(0);
35
36 return result;
37}
38
39var result = bar();
40if (result != false)
41 throw "Error: bad result expected false: " + result;
42if (count != loopCount)
43 throw "Error: bad count, expected: " + loopCount + ", got: " + count;