js/src/jit-test/tests/jaeger/bug738525.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/jaeger/bug738525.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +// Test IC for getters backed by a JSNative.
     1.5 +function test1() {
     1.6 +    for (var i = 0; i < 60; i++) {
     1.7 +        assertEq(it.customNative, undefined);
     1.8 +    }
     1.9 +
    1.10 +    var res = 0;
    1.11 +    for (var i = 0; i < 60; i++) {
    1.12 +        it.customNative = i;
    1.13 +        res += it.customNative;
    1.14 +    }
    1.15 +
    1.16 +    assertEq(res, 1770);
    1.17 +}
    1.18 +function test2() {
    1.19 +    function getValue() {
    1.20 +        return it.customNative;
    1.21 +    }
    1.22 +
    1.23 +    for (var i = 0; i < 60; i++) {
    1.24 +        it.customNative = i;
    1.25 +        assertEq(getValue(), i);
    1.26 +    }
    1.27 +
    1.28 +    for (var i = 0; i < 60; i++) {
    1.29 +        it.customNative = null;
    1.30 +        assertEq(getValue(), null);
    1.31 +
    1.32 +        delete it["customNativ" + "e"];
    1.33 +        assertEq(getValue(), undefined);
    1.34 +        assertEq(it.customNative, undefined);
    1.35 +    }
    1.36 +}
    1.37 +if ("it" in this) {
    1.38 +    test1();
    1.39 +    test2();
    1.40 +}

mercurial