Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function SSA(pipeline) {
this.pipeline = pipeline;
this.visited = new BitField(this.pipeline.blocks.length);
// List of phis for each block
this.phi = new Array(this.pipeline.blocks.length);
for (var i = 0; i < this.phi.length; i++)
this.phi[i] = [];
this.maxStore = 0;
this.env = null;
}
module.exports = SSA;
Dominance.prototype.enumerate = function enumerate() {
// Simple DFS with range tracking
var queue = [ this.blocks[0] ];
var visited = new BitField(this.blocks.length);
this.blocks[0].dominanceDepth = 0;
var index = 0;
while (queue.length !== 0) {
var block = queue[queue.length - 1];
if (!visited.set(block.blockIndex))
continue;
for (var i = block.children.length - 1; i >= 0; i--)
queue.push(block.children[i]);
block.dominanceStart = index++;
if (block.parent !== null)
block.dominanceDepth = block.parent.dominanceDepth + 1;
CFGBuilder.prototype._reindexBlocks = function _reindexBlocks() {
var out = [];
var visited = new BitField(this.blocks.length);
var queue = [ this.blocks[0] ];
while (queue.length !== 0) {
var block = queue.pop();
var ready = true;
for (var i = 0; i < block.predecessors.length; i++)
if (!visited.check(block.predecessors[i].blockIndex))
ready = false;
// Back edge
if (queue.length === 0)
ready = true;
if (!ready)
continue;
if (visited.set(block.blockIndex))