js/src/jit-test/tests/basic/testSetProtoRegeneratesObjectShape.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/testSetProtoRegeneratesObjectShape.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +function testSetProtoRegeneratesObjectShape()
     1.5 +{
     1.6 +  var f = function() {};
     1.7 +  var g = function() {};
     1.8 +  g.prototype.__proto__ = {};
     1.9 +
    1.10 +  function iq(obj)
    1.11 +  {
    1.12 +    for (var i = 0; i < 10; ++i)
    1.13 +      "" + obj.prototype;
    1.14 +  }
    1.15 +
    1.16 +  iq(f);
    1.17 +  iq(f);
    1.18 +  iq(f);
    1.19 +  iq(f);
    1.20 +  iq(g);
    1.21 +
    1.22 +  if (shapeOf(f.prototype) === shapeOf(g.prototype))
    1.23 +    return "object shapes same after proto of one is changed";
    1.24 +
    1.25 +  return true;
    1.26 +}
    1.27 +assertEq(testSetProtoRegeneratesObjectShape(), true);

mercurial