]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/multi-get-by-offset-dce.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / multi-get-by-offset-dce.js
1 function foo(o) {
2 var tmp = o.f;
3 return 42;
4 }
5
6 noInline(foo);
7
8 var array = [{f:1}, {g:1, f:2}];
9 for (var i = 0; i < 10000; ++i) {
10 var result = foo(array[i % array.length]);
11 if (result != 42)
12 throw "Error: bad result in loop: " + result;
13 }
14
15 var o = {};
16 var didCallGetter = false;
17 o.__defineGetter__("f", function() { didCallGetter = true; return 73; });
18 var result = foo(o);
19 if (result != 42)
20 throw "Error: bad result at end: " + result;
21 if (!didCallGetter)
22 throw "Error: did not call getter at end.";