summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testSetProtoRegeneratesObjectShape.js
blob: 1c6e0da3ccb3a51dea5f7ff65ff1c62e61e5c712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function testSetProtoRegeneratesObjectShape()
{
  var f = function() {};
  var g = function() {};
  g.prototype.__proto__ = {};

  function iq(obj)
  {
    for (var i = 0; i < 10; ++i)
      "" + obj.prototype;
  }

  iq(f);
  iq(f);
  iq(f);
  iq(f);
  iq(g);

  if (shapeOf(f.prototype) === shapeOf(g.prototype))
    return "object shapes same after proto of one is changed";

  return true;
}
assertEq(testSetProtoRegeneratesObjectShape(), true);