summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/baseline/osr-large-stack-frame.js
blob: bcaca2cfc2d660097fbd06e7ca1a36e937d1e8cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Creates a huge stack frame and uses OSR. See bug 1839669.
function f() {
    var varinits = [];
    var varnames = [];
    for (var i = 0; i < 19553; i++) {
        var varname = `x${i}`;
        varnames.push(varname);
        varinits.push(`${varname} = ${i}`);
    }
    var source = "var " + varinits.join(",") + ";\n";
    source += "for (var i = 0; i < 100; i++) {}\n";
    source += "return " + varnames.join("+") + ";";

    var g = new Function(source);
    assertEq(g(), 191150128);
    assertEq(g(), 191150128);
}
f();