]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/new-array-dead.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / new-array-dead.js
1 // Tests when we have a dead NewArray that we end up killing and there are other things in the basic block.
2
3 function foo(a, b, c) {
4 var d = a + b;
5 var e = b + c;
6 var f = c + a;
7 var g = a - b;
8 var h = b - c;
9 var i = c - a;
10 var j = [a + 1, b + 2, c + 3, d + 4, e + 5, f + 6, g + 7, h + 8, i + 9];
11 var d = a * b;
12 var e = b * c;
13 var f = c * a;
14 var g = a / b;
15 var h = b / c;
16 var i = c / a;
17 var j = [a + 10, b + 11, c + 12, d + 13, e + 14, f + 15, g + 16, h + 17, i + 18];
18 var d = a % b;
19 var e = b % c;
20 var f = c % a;
21 var g = b - a;
22 var h = c - b;
23 var i = a - c;
24 var j = [a + 19, b + 20, c + 21, d + 22, e + 23, f + 24, g + 25, h + 26, i + 27];
25 var d = b / a;
26 var e = c / b;
27 var f = a + c;
28 var g = b % a;
29 var h = c % b;
30 var i = a % c;
31 var j = [a + 28, b + 29, c + 30, d + 31, e + 32, f + 33, g + 34, h + 35, i + 36];
32 return 42;
33 }
34
35 noInline(foo);
36
37 for (var i = 0; i < 100000; ++i) {
38 var result = foo(1.5, 2.5, 3.5);
39 if (result != 42)
40 throw "Error: bad result: " + result;
41 }
42