X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/4be4e30906bcb8ee30b4d189205cb70bad6707ce..81345200c95645a1b0d2635520f96ad55dfde63f:/tests/stress/dead-access-to-captured-variable-preceded-by-a-live-store-in-function-with-multiple-basic-blocks.js diff --git a/tests/stress/dead-access-to-captured-variable-preceded-by-a-live-store-in-function-with-multiple-basic-blocks.js b/tests/stress/dead-access-to-captured-variable-preceded-by-a-live-store-in-function-with-multiple-basic-blocks.js new file mode 100644 index 0000000..ab8e3f3 --- /dev/null +++ b/tests/stress/dead-access-to-captured-variable-preceded-by-a-live-store-in-function-with-multiple-basic-blocks.js @@ -0,0 +1,26 @@ +function foo(p) { + if (p) { + var x = 42; + (function() { x = 43; })(); + x++; + var realResult = x; + (function() { x = 44; })(); + var fakeResult = x; + return realResult; + } + var y = 45; + (function() { y = 46; })(); + y++; + var realResult2 = y; + (function() { y = 47; })(); + var fakeResult2 = y; + return realResult2; +} + +noInline(foo); + +for (var i = 0; i < 10000; ++i) { + var result = foo(i & 1); + if (result != ((i & 1) ? 44 : 47)) + throw "Error: bad result with i = " + i + ": " + result; +}