public void forEachBlockDepthFirstDom(SsaBasicBlock.Visitor v) {
    BitSet visited = new BitSet(getBlocks().size());
    Stack<SsaBasicBlock> stack = new Stack<SsaBasicBlock>();

    stack.add(getEntryBlock());

    while (stack.size() > 0) {
      SsaBasicBlock cur = stack.pop();
      ArrayList<SsaBasicBlock> curDomChildren = cur.getDomChildren();

      if (!visited.get(cur.getIndex())) {
        // We walk the tree this way for historical reasons...
        for (int i = curDomChildren.size() - 1; i >= 0; i--) {
          SsaBasicBlock child = curDomChildren.get(i);
          stack.add(child);
        }
        visited.set(cur.getIndex());
        v.visitBlock(cur, null);
      }
    }
  }
Visits blocks in dom-tree order, starting at the current node. The {@code parent} parameter of
the Visitor.visitBlock callback is currently always set to null.

@param v {@code non-null;} callback interface
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/SsaMethod.java