js/src/jit-test/tests/pic/watch1a.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/watch1a.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +// assignments to watched objects 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 +(function () {
    1.12 +    var obj = {x: 0, y: 0};
    1.13 +    var a = ['x', 'y'];
    1.14 +    obj.watch('z', counter);
    1.15 +    for (var i = 0; i < 14; i++) {
    1.16 +        obj.watch(a[+(i > 8)], counter);
    1.17 +        obj.y = i;
    1.18 +    }
    1.19 +})();
    1.20 +assertEq(hits, 5);

mercurial