function _getSortedTagMarks(marks, markCache) {
        marks = marks.filter(function (mark) {
            return !!mark.tagID;
        }).map(function (mark) {
            // All marks should exist since we just got them from CodeMirror.
            if (!markCache[mark.tagID]) {
                markCache[mark.tagID] = {mark: mark, range: mark.find()};
            }
            return markCache[mark.tagID];
        });
        marks.sort(function (mark1, mark2) {
            return (mark1.range.from.line === mark2.range.from.line ?
                    mark1.range.from.ch - mark2.range.from.ch :
                    mark1.range.from.line - mark2.range.from.line);
        });

        return marks;
    }
@private
Filters the given marks to find the ones that correspond to instrumented tags,
sorts them by their starting position, and looks up and/or stores their ranges
in the given markCache.
@param {Array} marks An array of mark objects returned by CodeMirror.
@param {Object} markCache An object that maps tag IDs to {mark, range} objects.
    If a mark in the marks array is already in the cache, we use the cached range info,
    otherwise we look up its range in CodeMirror and store it in the cache.
@return {Array.<{mark: Object, range: {line: number, ch: number}}>} The filtered and
    sorted array of mark info objects (each of which contains the mark and its range,
    so the range doesn't need to be looked up again).