]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/singleton-scope-then-realloc-and-overwrite.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / singleton-scope-then-realloc-and-overwrite.js
1 function foo(a) {
2 var x = a + 1;
3 return function(a) {
4 return x + a;
5 };
6 }
7
8 var f = foo(42);
9 noInline(f);
10
11 for (var i = 0; i < 10000; ++i) {
12 var result = f(i);
13 if (result != 42 + 1 + i)
14 throw "Error: bad result: " + result;
15 }
16
17 var f = foo(43);
18 var result = f(1);
19 if (result != 43 + 1 + 1)
20 throw "Error: bad result: " + result;