js/src/jit-test/tests/auto-regress/bug674843.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/auto-regress/bug674843.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +// Binary: cache/js-dbg-64-d066929dd830-linux
     1.5 +// Flags: -m
     1.6 +//
     1.7 +function fnSupportsArrayIndexGettersOnObjects() {
     1.8 +    if (fnExists(Object.defineProperty)) {
     1.9 +        var obj = {};
    1.10 +        Object.defineProperty(obj, "0", {
    1.11 +            get: function () {
    1.12 +                supportsArrayIndexGettersOnObjects = true;
    1.13 +            }
    1.14 +        });
    1.15 +        var res = obj[0];
    1.16 +    }
    1.17 +    return supportsArrayIndexGettersOnObjects;
    1.18 +}
    1.19 +function fnExists( /*arguments*/ ) {
    1.20 +    return true;
    1.21 +}
    1.22 +var ES5Harness = (function () {
    1.23 +    var $this = this;
    1.24 +    function registerTest(test) {
    1.25 +        if (!(test.precondition && !test.precondition())) {
    1.26 +            try {
    1.27 +                var res = test.test.call($this);
    1.28 +            } catch (e) {}
    1.29 +        }
    1.30 +    }
    1.31 +    return {
    1.32 +        registerTest: registerTest
    1.33 +    }
    1.34 +})();
    1.35 +ES5Harness.registerTest({
    1.36 +    test: function testcase() {
    1.37 +        function callbackfn(accum, val, idx, obj) {
    1.38 +            if (idx === 1 && val === 1) {}
    1.39 +        }
    1.40 +        var obj = {
    1.41 +            length: 10
    1.42 +        };
    1.43 +        Object.defineProperty(obj, "0", {
    1.44 +            get: function () {
    1.45 +                defineProperty(idx, idx, registerTest + ": }}}}}");
    1.46 +            },
    1.47 +        });
    1.48 +        try {
    1.49 +            Array.prototype.reduce.call(obj, callbackfn, "initialValue");
    1.50 +        } finally {}
    1.51 +    },
    1.52 +    precondition: function prereq() {
    1.53 +        return fnExists(Array.prototype.reduce) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects();
    1.54 +    }
    1.55 +});
    1.56 +ES5Harness.registerTest({
    1.57 +    test: function testcase() {
    1.58 +        var obj = {};
    1.59 +        Object.defineProperty(obj, "property", {
    1.60 +            configurable: new Date()
    1.61 +        });
    1.62 +    },
    1.63 +    precondition: function prereq() {
    1.64 +        return fnExists(gczeal(2));
    1.65 +    }
    1.66 +});

mercurial