]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/weird-getter-counter.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / weird-getter-counter.js
CommitLineData
ed1e77d3
A
1function foo(o) {
2 return o.f;
3}
4
5noInline(foo);
6
7var counter = 0;
8
9function test(o, expected, expectedCount) {
10 var result = foo(o);
11 if (result != expected)
12 throw new Error("Bad result: " + result);
13 if (counter != expectedCount)
14 throw new Error("Bad counter value: " + counter);
15}
16
17for (var i = 0; i < 100000; ++i) {
18 var o = {};
19 o.__defineGetter__("f", function() {
20 counter++;
21 return 84;
22 });
23 test(o, 84, counter + 1);
24}