michael@0: var causeOSI = true; michael@0: michael@0: function rec(x, self) { michael@0: if (x === 0 || x !== x) { michael@0: if (causeOSI) { michael@0: causeOSI = false; michael@0: self(NaN, self) michael@0: causeOSI = true; michael@0: } michael@0: return; michael@0: } michael@0: self(x - 1, self); michael@0: } michael@0: michael@0: // Use enough iterations to type infer the script. michael@0: causeOSI = false; michael@0: for (var i = 0; i < 20; ++i) michael@0: rec(1, rec); michael@0: causeOSI = true; michael@0: michael@0: rec(2, rec)