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