]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/fold-multi-get-by-offset-to-get-by-offset.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / fold-multi-get-by-offset-to-get-by-offset.js
CommitLineData
81345200
A
1//@ defaultNoEagerRun
2
3function foo(o) {
4 return o.f;
5}
6
7for (var i = 0; i < 100; ++i) {
8 var result = foo((i & 1) ? {f:1, g:2} : {g:1, f:2});
9 if (result != 2 - (i & 1))
10 throw "Error: bad result in warm-up loop for i = " + i + ": " + result;
11}
12
13function bar(o) {
14 return o.g + foo(o);
15}
16
17noInline(bar);
18
19for (var i = 0; i < 100000; ++i) {
20 var result = bar({f:i, g:i * 3});
21 if (result != i * 4)
22 throw "Error: bad result for i = " + i + ": " + result;
23}
24
25if (reoptimizationRetryCount(bar))
26 throw "Error: reoptimized bar unexpectedly: " + reoptimizationRetryCount(bar);