blob: e7b1de402f0cf036dabfe6ec352e0d1e88c6870f [file] [log] [blame]
fpizlo@apple.com3aef57f2012-06-30 19:28:26 +00001description(
2"Tests that attempts by the DFG simplification to short-circuit a Phantom to a GetLocal on a variable that is SetLocal'd in the same block, and where the predecessor block(s) make no mention of that variable, do not result in crashes."
3);
4
5function baz() {
6 // Do something that prevents inlining.
7 return function() { }
8}
9
10function stuff(z) { }
11
12function foo(x, y) {
13 var a = arguments; // Force arguments to be captured, so that x is captured.
14 baz();
15 var z = x;
16 stuff(z); // Force a Flush, and then a Phantom on the GetLocal of x.
17 return 42;
18}
19
20var o = {
21 g: function(x) { }
22};
23
24function thingy(o) {
25 var p = {};
26 var result;
27 // Trick to delay control flow graph simplification until after the flush of x above gets turned into a phantom.
28 if (o.g)
29 p.f = true;
30 if (p.f) {
31 // Basic block that stores to x in foo(), which is a captured variable, with
32 // the predecessor block making no mention of x.
33 result = foo("hello", 2);
34 }
35 return result;
36}
37
fpizlo@apple.com299a8ee2013-09-05 15:54:07 +000038dfgShouldBe(thingy, "thingy(o)", "42");