michael@0: // Enter an Ion constructor via on-stack replacement. michael@0: michael@0: // This gets compiled and called by the interpreter. michael@0: // Allocation and primitive check need to happen caller-side. michael@0: function Foo() { michael@0: var y = 0; michael@0: for (var i = 0; i < 100; i++) michael@0: { y++ } michael@0: this.x = 5; michael@0: return y; michael@0: } michael@0: michael@0: eval("//nothing"); // Prevent compilation of global script. michael@0: michael@0: for (var i = 0; i < 100; i++) { michael@0: var x = new Foo(); michael@0: assertEq(typeof(x), "object"); michael@0: }