blob: 2895c26451d257a97a2db3ec58929b9d55343251 [file] [log] [blame]
utatane.tea@gmail.comfccd1362015-08-11 22:02:09 +00001var symbol = Symbol();
2function Hello() {
3}
4
5Object.defineProperty(Hello, symbol, {
6 get: function () {
7 return this;
8 }
9});
10
11Hello.prototype.generate = function () {
12 return new this.constructor[symbol]();
13};
14
15function ok() {
16 var object = new Hello();
17 if (!(object.generate() instanceof Hello))
18 throw new Error("bad instance");
19}
20noInline(ok);
21
22for (var i = 0; i < 10000; ++i)
23 ok();