]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/put-by-id-build-list-order-recurse.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / put-by-id-build-list-order-recurse.js
CommitLineData
ed1e77d3
A
1var count = 0;
2
3function setter(value) {
4 Object.defineProperty(
5 this, "f", {
6 enumerable: true,
7 configurable: true,
8 writable: true,
9 value: 32
10 });
11 var o = Object.create(this);
12 var currentCount = count++;
13 var str = "for (var i = " + currentCount + "; i < " + (100 + currentCount) + "; ++i)\n"
14 + " o.f\n";
15 eval(str);
16}
17
18function foo(o) {
19 o.f = 42;
20}
21
22noInline(foo);
23
24for (var i = 0; i < 1000; ++i) {
25 var o = {};
26 o.__defineSetter__("f", setter);
27
28 foo(o);
29 if (o.f != 32)
30 throw ("Error 1: "+o.f);
31
32 foo(o);
33 if (o.f != 42)
34 throw ("Error 2: "+o.f);
35}