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