js/src/jit-test/tests/pic/watch3b.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/pic/watch3b.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +// assignment to watched global properties must not be traced
     1.5 +var hits = 0;
     1.6 +function counter(id, oldval, newval) {
     1.7 +    hits++;
     1.8 +    return newval;
     1.9 +}
    1.10 +
    1.11 +var x = 0;
    1.12 +var y = 0;
    1.13 +function f() {
    1.14 +    var a = [{}, this];
    1.15 +    for (var i = 0; i < 14; i++) {
    1.16 +        print(shapeOf(this));
    1.17 +        Object.prototype.watch.call(a[+(i > 8)], "y", counter);
    1.18 +        y++;
    1.19 +    }
    1.20 +}
    1.21 +f();
    1.22 +assertEq(hits, 5);
    1.23 +

mercurial