1function foo(o) { 2 return o.f + 1; 3} 4 5Number.prototype.f = 42; 6 7noInline(foo); 8 9for (var i = 0; i < 100000; ++i) { 10 var result = foo(23); 11 if (result != 43) 12 throw "Error: bad result: " + result; 13 result = foo({f:25}); 14 if (result != 26) 15 throw "Error: bad result: " + result; 16 result = foo({g:12, f:13}); 17 if (result != 14) 18 throw "Error: bad result: " + result; 19} 20 21var didThrow; 22try { 23 foo(void 0); 24} catch (e) { 25 didThrow = e; 26} 27 28if (!didThrow || didThrow.toString().indexOf("TypeError:") != 0) 29 throw "Error: didn't throw or threw wrong exception: " + didThrow; 30