commit-queue@webkit.org | a4201b0 | 2015-08-17 22:24:20 +0000 | [diff] [blame] | 1 | function sink (p, q) { |
| 2 | var g = x => x; |
| 3 | if (p) { if (q) g.inner = 42; return g; } |
| 4 | return x => x; |
| 5 | } |
| 6 | noInline(sink); |
| 7 | |
| 8 | for (var i = 0; i < 10000; ++i) { |
| 9 | var f = sink(true, true); |
| 10 | var result = f(42); |
| 11 | if (result != 42) |
| 12 | throw "Error: expected 42 but got " + result; |
| 13 | } |
| 14 | |
| 15 | // At this point, the function should be compiled down to the FTL |
| 16 | |
| 17 | // Test the allocation on the implicit inner else branch |
| 18 | var f = sink(true, false); |
| 19 | var result = f(12); |
| 20 | if (result != 12) |
| 21 | // This shouldn't matter as it should be either correct or completely crash |
| 22 | throw "Error: expected 12 but got " + result; |
| 23 | |
| 24 | // Check that the allocation did not sink beyond the property assignment |
| 25 | var f = sink(true, true); |
| 26 | var result = f.inner; |
| 27 | if (result != 42) |
| 28 | throw "Error: inner should be 42 but is " + result; |