]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/poly-setter-combo.js
3 Cons1
.prototype.f
= 42;
8 Cons2
.prototype.__defineSetter__("f", function(value
) {
11 this._values
[value
] = 1;
13 Cons2
.prototype.__defineGetter__("f", function() { return this._f
; });
17 Cons3
.prototype.f
= 42;
18 Cons3
.prototype.g
= 43;
23 Cons4
.prototype.g
= 16;
24 Cons4
.prototype.__defineSetter__("f", function(value
) {
27 this._values
[value
] = 1;
29 Cons4
.prototype.__defineGetter__("f", function() { return this._f
; });
31 function foo(o
, value
) {
40 function test(o
, value
, expectedCount
) {
41 var result
= foo(o
, value
);
43 throw new Error("Bad result: " + result
);
44 if (counter
!= expectedCount
)
45 throw new Error("Bad counter value: " + counter
);
48 function runTestWithConstructors(constructor1
, constructor2
) {
49 for (var i
= 0; i
< 5000; ++i
) {
50 test(new constructor1(), i
, counter
);
51 test(new constructor2(), i
, counter
+ 1);
54 o
.__defineGetter__("f", function() {
58 test(o
, 84, counter
+ 1);
61 o
.__defineSetter__("f", function(value
) {
65 o
.__defineGetter__("f", function() { return this._f
; });
66 test(o
, i
, counter
+ 1);
68 test({f: 42}, i
, counter
);
72 for (var i
= 0; i
< 2; ++i
) {
73 runTestWithConstructors(Cons1
, Cons2
);
74 runTestWithConstructors(Cons3
, Cons2
);
75 runTestWithConstructors(Cons1
, Cons4
);
76 runTestWithConstructors(Cons3
, Cons4
);