blob: 8db70bb9abc23148f627efc6186be057c3cbb276 [file] [log] [blame]
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +00001function sink (p, q) {
2 var g = x => x;
3 if (p) { if (q) g.inner = 42; return g; }
4 return x => x;
5}
6noInline(sink);
7
8for (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
18var f = sink(true, false);
19var result = f(12);
20if (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
25var f = sink(true, true);
26var result = f.inner;
27if (result != 42)
28 throw "Error: inner should be 42 but is " + result;