function visit(node, parent, depth) {
    // Set up parent points for reverse stack traversal.
    node['parent'] = parent;
    // We need the depth for stack alignment in traverseStacks.
    node['depth'] = depth;
    var uid = node['callUID'];
    if (!eventTypesByCallUID[uid]) {
      var fnName = node['functionName'] || '(unknown)';
      // GCs are weird, see comment in the sample loop below.
      if (fnName == '(garbage collector)') {
        gcNode = node;
      } else if (fnName == '(idle)') {
        idleNode = node;
      }
      // fnName can be '(anonymous function)' and other special names, turn that
      // into a valid function name like '_anonymous_function_'.
      fnName = fnName.replace(/[^\.a-zA-Z_\$]/g, '_');
      eventTypesByCallUID[uid] = eventTypeTable.defineType(
          wtf.db.EventType.createScope(fnName));
    }
    reverseStacksById[node['id']] = node;
    node['children'].forEach(function(child) {
      visit(child, node, depth + 1);
    });
  }
Processes the full buffer.
@param {!Uint8Array} buffer Data buffer.
@private