]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/function-sinking-no-double-allocate.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / function-sinking-no-double-allocate.js
1 function call(o) { o.x = 3; }
2 noInline(call);
3
4 function sink (p, q) {
5 var f = function () { };
6 if (p) {
7 call(f); // Force allocation of f
8 if (q) {
9 OSRExit();
10 }
11 return f;
12 }
13 return { 'x': 2 };
14 }
15 noInline(sink);
16
17 for (var i = 0; i < 100000; ++i) {
18 var o = sink(true, false);
19 if (o.x != 3)
20 throw "Error: expected o.x to be 2 but is " + result;
21 }
22
23 // At this point, the function should be compiled down to the FTL
24
25 // Check that the function is properly allocated on OSR exit
26 var f = sink(true, true);
27 if (f.x != 3)
28 throw "Error: expected o.x to be 3 but is " + result;