]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/not-cell-use.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / not-cell-use.js
CommitLineData
81345200
A
1function foo(a, b, c) {
2 return (a|0) + (b|0) + (c|0);
3}
4
5function bar(o) {
6 var a = o.f;
7 var b = o.g;
8 var c = o.h;
9 var d = o.i;
10 var e = o.j;
11 var f = o.k;
12 var g = o.l;
13 return foo(42, void 0, void 0) + a + b + c + d + e + f + g;
14}
15
16noInline(foo);
17noInline(bar);
18
19for (var i = 0; i < 100000; ++i) {
20 var result = bar({
21 f:i * 3, g:i - 1, h:(i / 2)|0, i:-i, j:13 + ((i / 5)|0), k:14 - ((i / 6)|0),
22 l:1 - i});
23
24 var expected = 42 + i * 3 + i - 1 + ((i / 2)|0) - i + 13 + ((i / 5)|0) + 14 -
25 ((i / 6)|0) + 1 - i;
26
27 if (result != expected)
28 throw "Error: for iteration " + i + " expected " + expected + " but got " + result;
29}