Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | var seen = -1; |
michael@0 | 2 | |
michael@0 | 3 | // Test to make sure the jits get the number of calls, and return value |
michael@0 | 4 | // of setters correct. We should not be affected by whether the setter |
michael@0 | 5 | // modifies its argument or returns some value. |
michael@0 | 6 | function setter(x) { |
michael@0 | 7 | this.val = x; |
michael@0 | 8 | x = 255; |
michael@0 | 9 | bailout(); |
michael@0 | 10 | seen++; |
michael@0 | 11 | assertEq(seen, this.val); |
michael@0 | 12 | return 5; |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | function F(){} |
michael@0 | 16 | Object.defineProperty(F.prototype, "value" , ({set: setter})); |
michael@0 | 17 | |
michael@0 | 18 | function test() { |
michael@0 | 19 | var obj = new F(); |
michael@0 | 20 | var itrCount = 10000; |
michael@0 | 21 | for(var i = 0; i < itrCount; i++) { |
michael@0 | 22 | assertEq(obj.value = i, i); |
michael@0 | 23 | assertEq(obj.val, i); |
michael@0 | 24 | } |
michael@0 | 25 | } |
michael@0 | 26 | test(); |