js/src/jit-test/tests/basic/new-read-before-write.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/basic/new-read-before-write.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +
     1.5 +function Foo() {
     1.6 +  var x = this.property;
     1.7 +  this.property = 5;
     1.8 +  glob = x;
     1.9 +}
    1.10 +Foo.prototype.property = 10;
    1.11 +for (var i = 0; i < 10; i++) {
    1.12 +  new Foo();
    1.13 +  assertEq(glob, 10);
    1.14 +}
    1.15 +
    1.16 +function Bar() {
    1.17 +  this.property;
    1.18 +  this.other = 5;
    1.19 +}
    1.20 +Bar.prototype.other = 10;
    1.21 +Object.defineProperty(Bar.prototype, "property", {
    1.22 +  get: function() { glob = this.other; }
    1.23 +});
    1.24 +for (var i = 0; i < 10; i++) {
    1.25 +  new Bar();
    1.26 +  assertEq(glob, 10);
    1.27 +}

mercurial