michael@0: // vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: michael@0: function f(x, y) { michael@0: // Confuse the type analysis to not know the type of x. michael@0: var u; michael@0: var a = x + u; michael@0: var b = x + 3; michael@0: return x + y; michael@0: } michael@0: michael@0: function g_bool(x, y) { michael@0: var t; michael@0: if (x + 0) michael@0: t = true; michael@0: else michael@0: t = false; michael@0: return t + y; michael@0: michael@0: } michael@0: function g_null(x) { michael@0: return null + x; michael@0: } michael@0: michael@0: assertEq(g_bool(1, 2), 3); michael@0: assertEq(g_bool(0, 2), 2); michael@0: assertEq(g_null(2), 2); michael@0: michael@0: // These will not bailout. michael@0: assertEq(f(Math.cos(Math.PI), 2), 1); michael@0: assertEq(f(null, 2), 2); michael@0: assertEq(f(false, 2), 2); michael@0: assertEq(f(true, 2), 3); michael@0: assertEq(f(17, 2), 19); michael@0: michael@0: // These will bailout. michael@0: assertEq(f(undefined, 2), Number.NaN); michael@0: assertEq(f("20", 2), "202"); michael@0: assertEq(f(16.3, 2), 18.3); michael@0: assertEq((1 / f(-0, -0)), -Infinity); michael@0: michael@0: