msaboff@apple.com | 9589433 | 2014-01-29 19:18:54 +0000 | [diff] [blame] | 1 | function Foo() { } |
| 2 | |
| 3 | Foo.prototype.toString = function() { return "hello" }; |
| 4 | |
| 5 | function foo(o) { |
| 6 | return String(o); |
| 7 | } |
| 8 | |
| 9 | noInline(foo); |
| 10 | |
| 11 | for (var i = 0; i < 100000; ++i) { |
| 12 | var result = foo(new Foo()); |
| 13 | if (typeof result != "string") { |
| 14 | describe(result); |
| 15 | throw "Error: result isn't a string"; |
| 16 | } |
| 17 | if (result != "hello") |
| 18 | throw "Error: bad result: " + result; |
| 19 | |
| 20 | result = foo("world"); |
| 21 | if (typeof result != "string") { |
| 22 | describe(result); |
| 23 | throw "Error: result isn't a string"; |
| 24 | } |
| 25 | if (result != "world") |
| 26 | throw "Error: bad result: " + result; |
| 27 | } |