js/src/jit-test/tests/ion/bug765454.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/ion/bug765454.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +var seen = -1;
     1.5 +
     1.6 +// Test to make sure the jits get the number of calls, and return value
     1.7 +// of setters correct. We should not be affected by whether the setter
     1.8 +// modifies its argument or returns some value.
     1.9 +function setter(x) {
    1.10 +    this.val = x;
    1.11 +    x = 255;
    1.12 +    bailout();
    1.13 +    seen++;
    1.14 +    assertEq(seen, this.val);
    1.15 +    return 5;
    1.16 +}
    1.17 +
    1.18 +function F(){}
    1.19 +Object.defineProperty(F.prototype, "value" , ({set: setter}));
    1.20 +
    1.21 +function test() {
    1.22 +    var obj = new F();
    1.23 +    var itrCount = 10000;
    1.24 +    for(var i = 0; i < itrCount; i++) {
    1.25 +        assertEq(obj.value = i, i);
    1.26 +        assertEq(obj.val, i);
    1.27 +    }
    1.28 +}
    1.29 +test();

mercurial