summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/bug1636306.js
blob: ab538831fedc546b772a89f4840209bdf340385d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// |jit-test| --no-ion

oomTest(() => { eval(`
    function getCallee() { return getCallee.caller; }

    // Use trickery to get a reference to a run-once function. We avoid
    // expanding the lazy inner functions in this first invocation.
    let fn = function(x) {
        if (x) {
            // Singleton 'inner'
            let _ = function() {
                function inner() {}
            }();

            // Non-singleton 'inner'
            for (var i = 0; i < 2; i++) {
                let _ = function() {
                    function inner() {}
                }();
            }
        }

        return getCallee();
    }(false);

    // Run the lazy functions inside 'fn' this time. Run twice to check
    // delazification still works after OOM failure.
    for (var i = 0; i < 2; i++) {
        try { fn(true); }
        catch (e) { }
    }
`)});