lib/third_party/tracing/model/slice.js
function(callback, opt_this) {
      var parentStack = [];
      var started = false;

      // get the root node and push it to the DFS stack
      var topmostSlice = this.mostTopLevelSlice;
      parentStack.push(topmostSlice);

      // Using the stack to perform DFS
      while (parentStack.length !== 0) {
        var curSlice = parentStack.pop();

        if (started)
          callback.call(opt_this, curSlice);
        else
          started = (curSlice.guid === this.guid);

        for (var i = curSlice.subSlices.length - 1; i >= 0; i--) {
          parentStack.push(curSlice.subSlices[i]);
        }
      }
    }
function(callback, opt_this) {
      var parentStack = [];
      var started = false;

      // get the root node and push it to the DFS stack
      var topmostSlice = this.mostTopLevelSlice;
      parentStack.push(topmostSlice);

      // Using the stack to perform DFS
      while (parentStack.length !== 0) {
        var curSlice = parentStack.pop();

        if (started)
          callback.call(opt_this, curSlice);
        else
          started = (curSlice.guid === this.guid);

        for (var i = curSlice.subSlices.length - 1; i >= 0; i--) {
          parentStack.push(curSlice.subSlices[i]);
        }
      }
    }
function ( callback , opt_this ) { var parentStack = [ ] ; var started = false ; // get the root node and push it to the DFS stack var topmostSlice = this . mostTopLevelSlice ; parentStack . push ( topmostSlice ) ; // Using the stack to perform DFS while ( parentStack . length !== 0 ) { var curSlice = parentStack . pop ( ) ; if ( started ) callback . call ( opt_this , curSlice ) ; else started = ( curSlice . guid === this . guid ) ; for ( var i = curSlice . subSlices . length - 1 ; i >= 0 ; i -- ) { parentStack . push ( curSlice . subSlices [ i ] ) ; } } }
Obtains all subsequent slices of this slice.

Subsequent slices are slices that get executed after a particular
slice, i.e., all the functions that are called after the current one.

For instance, E.iterateAllSubsequentSlices() in the following example:
[     A          ]
[ B][  D   ][ G  ]
[C] [E][F]  [H]
will pass F, G, then H to the provided callback.

The reason we need subsequent slices of a particular slice is that
when there is flow event goes into, e.g., E, we only want to highlight
E's subsequent slices to indicate the execution order.

The idea to calculate the subsequent slices of slice E is to view
the slice group as a tree where the top-level slice A is the root node.
The preorder depth-first-search (DFS) order is naturally equivalent
to the function call order. We just need to perform a DFS, and start
recording the slices after we see the occurance of E.
Obtains all subsequent slices of this slice .