|
1 var seen = -1; |
|
2 |
|
3 // Test to make sure the jits get the number of calls, and return value |
|
4 // of setters correct. We should not be affected by whether the setter |
|
5 // modifies its argument or returns some value. |
|
6 function setter(x) { |
|
7 this.val = x; |
|
8 x = 255; |
|
9 bailout(); |
|
10 seen++; |
|
11 assertEq(seen, this.val); |
|
12 return 5; |
|
13 } |
|
14 |
|
15 function F(){} |
|
16 Object.defineProperty(F.prototype, "value" , ({set: setter})); |
|
17 |
|
18 function test() { |
|
19 var obj = new F(); |
|
20 var itrCount = 10000; |
|
21 for(var i = 0; i < itrCount; i++) { |
|
22 assertEq(obj.value = i, i); |
|
23 assertEq(obj.val, i); |
|
24 } |
|
25 } |
|
26 test(); |