| Index: test/webkit/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local.js
|
| diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local.js
|
| similarity index 57%
|
| copy from test/webkit/concat-while-having-a-bad-time.js
|
| copy to test/webkit/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local.js
|
| index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..65be965ccfc6c926e93fdaf024c503f5a8e7bf3b 100644
|
| --- a/test/webkit/concat-while-having-a-bad-time.js
|
| +++ b/test/webkit/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local.js
|
| @@ -22,10 +22,42 @@
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| description(
|
| -"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating."
|
| +"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."
|
| );
|
|
|
| -Object.defineProperty(Array.prototype, 0, { writable: false });
|
| -shouldBe("[42].concat()", "[42]");
|
| +function baz() {
|
| + // Do something that prevents inlining.
|
| + return function() { }
|
| +}
|
|
|
| +function stuff(z) { }
|
| +
|
| +function foo(x, y) {
|
| + var a = arguments; // Force arguments to be captured, so that x is captured.
|
| + baz();
|
| + var z = x;
|
| + stuff(z); // Force a Flush, and then a Phantom on the GetLocal of x.
|
| + return 42;
|
| +}
|
| +
|
| +var o = {
|
| + g: function(x) { }
|
| +};
|
| +
|
| +function thingy(o) {
|
| + var p = {};
|
| + var result;
|
| + // Trick to delay control flow graph simplification until after the flush of x above gets turned into a phantom.
|
| + if (o.g)
|
| + p.f = true;
|
| + if (p.f) {
|
| + // Basic block that stores to x in foo(), which is a captured variable, with
|
| + // the predecessor block making no mention of x.
|
| + result = foo("hello", 2);
|
| + }
|
| + return result;
|
| +}
|
| +
|
| +for (var i = 0; i < 200; ++i)
|
| + shouldBe("thingy(o)", "42");
|
|
|
|
|