]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/poly-self-then-getter.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / poly-self-then-getter.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 test({f: 42}, 42, counter);
19
20 var o = {};
21 o.__defineGetter__("f", function() {
22 counter++;
23 return 84;
24 });
25 test(o, 84, counter + 1);
26}