src/third_party/mozjs/extract/js/src/devtools/rootAnalysis/loadCallgraph.js
// During the same scan, build callersOf from calleesOf.
During the same scan, build callersOf from calleesOf.
During the same scan build callersOf from calleesOf .
function merge_repeated_calls(calleesOf) {
    const callersOf = Object.create(null);
    for (const [caller, callee_limits] of Object.entries(calleesOf)) {
        const ordered_callees = [];
        const callee2limit = new Map();
        for (const {callee, limits} of callee_limits) {
            const prev_limits = callee2limit.get(callee);
            if (prev_limits === undefined) {
                callee2limit.set(callee, limits);
                ordered_callees.push(callee);
            } else {
                callee2limit.set(callee, prev_limits & limits);
            }
        }
        callee_limits.length = 0;
        for (const callee of ordered_callees) {
            const limits = callee2limit.get(callee);
            callee_limits.push({callee, limits});
            if (!(callee in callersOf))
                callersOf[callee] = [];
            callersOf[callee].push({caller, limits});
        }
    }
    return callersOf;
}
function merge_repeated_calls ( calleesOf ) { const callersOf = Object . create ( null ) ; for ( const [ caller , callee_limits ] of Object . entries ( calleesOf ) ) { const ordered_callees = [ ] ; const callee2limit = new Map ( ) ; for ( const { callee , limits } of callee_limits ) { const prev_limits = callee2limit . get ( callee ) ; if ( prev_limits === undefined ) { callee2limit . set ( callee , limits ) ; ordered_callees . push ( callee ) ; } else { callee2limit . set ( callee , prev_limits & limits ) ; } } callee_limits . length = 0 ; for ( const callee of ordered_callees ) { const limits = callee2limit . get ( callee ) ; callee_limits . push ( { callee , limits } ) ; if ( ! ( callee in callersOf ) ) callersOf [ callee ] = [ ] ; callersOf [ callee ] . push ( { caller , limits } ) ; } } return callersOf ; }
During the same scan, build callersOf from calleesOf.
During the same scan build callersOf from calleesOf .
// callee_limits is a list of {callee,limit} objects. // Update the contents of callee_limits to contain a single entry for // each callee, with its limits set to the AND of the limits observed // at all callsites within this caller function.