]> git.saurik.com Git - apple/javascriptcore.git/blame - 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
CommitLineData
ed1e77d3
A
1function call(o) { o.x = 3; }
2noInline(call);
3
4function 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}
15noInline(sink);
16
17for (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
26var f = sink(true, true);
27if (f.x != 3)
28 throw "Error: expected o.x to be 3 but is " + result;