1function foo(a, b) {
2    return Math.max(a.f, b.f);
3}
4
5noInline(foo);
6
7function test(a, b, c) {
8    var result = foo({f:a}, {f:b});
9    if (result != c)
10        throw "Error: expected " + c + " but got: " + result;
11}
12
13for (var i = 0; i < 100000; ++i)
14    test(true, 42, 42);
15
16// Now try some unexpected things, in descending order of possible badness.
17test(true, 2147483647, 2147483647);
18test(false, 42, 42);
19test(1, 2, 2);
20test(true, true, 1);
21test(1.5, 1.5, 1.5);
22
23