]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/getter.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / getter.js
1 function foo(o) {
2 return o.f + o.k * 1000;
3 }
4
5 noInline(foo);
6
7 for (var i = 0; i < 100; ++i) {
8 var o = {g_: 5};
9 o.__defineGetter__("f", function() { return 42 + this.g_; });
10 o.__defineGetter__("g", function() { return 43 + this.g_; });
11 o.__defineGetter__("h", function() { return 44 + this.g_; });
12 o.__defineGetter__("i", function() { return 45 + this.g_; });
13 o.__defineGetter__("j", function() { return 46 + this.g_; });
14 o.__defineGetter__("k", function() { return 47 + this.g_; });
15 var result = foo(o);
16 if (result != (42 + 5) + 1000 * (47 + 5))
17 throw "Error: bad result: " + result;
18 }