]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/dead-access-to-captured-variable-preceded-by-a-live-store-in-function-with-multiple-basic-blocks.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / dead-access-to-captured-variable-preceded-by-a-live-store-in-function-with-multiple-basic-blocks.js
CommitLineData
81345200
A
1function foo(p) {
2 if (p) {
3 var x = 42;
4 (function() { x = 43; })();
5 x++;
6 var realResult = x;
7 (function() { x = 44; })();
8 var fakeResult = x;
9 return realResult;
10 }
11 var y = 45;
12 (function() { y = 46; })();
13 y++;
14 var realResult2 = y;
15 (function() { y = 47; })();
16 var fakeResult2 = y;
17 return realResult2;
18}
19
20noInline(foo);
21
22for (var i = 0; i < 10000; ++i) {
23 var result = foo(i & 1);
24 if (result != ((i & 1) ? 44 : 47))
25 throw "Error: bad result with i = " + i + ": " + result;
26}