js/src/jit-test/tests/ion/getprop-cache.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/getprop-cache.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +function test1() {
     1.5 +    function h(node) {
     1.6 +        var x = 0.1;
     1.7 +        for (var i=0; i<100; i++) {
     1.8 +            x += node.parent;
     1.9 +        }
    1.10 +        return x;
    1.11 +    }
    1.12 +    function build(depth) {
    1.13 +        if (depth > 10)
    1.14 +            return {parent: 3.3};
    1.15 +        return {__proto__: build(depth + 1)};
    1.16 +    }
    1.17 +    var tree = build(0);
    1.18 +    assertEq(h(tree)|0, 330);
    1.19 +}
    1.20 +test1();
    1.21 +
    1.22 +function test2() {
    1.23 +    function Foo() {};
    1.24 +    Foo.prototype.x = 3.3;
    1.25 +
    1.26 +    var o = new Foo();
    1.27 +    for (var i=0; i<100; i++) {
    1.28 +        assertEq(o.x, 3.3);
    1.29 +    }
    1.30 +}
    1.31 +test2();

mercurial