code: private void trimCandidatesUsingOnCost() {
      Iterator<Entry<String, FunctionState>> i;
      for (i = fns.entrySet().iterator(); i.hasNext(); ) {
        FunctionState functionState = i.next().getValue();
        if (functionState.hasReferences()) {
          // Only inline function if it decreases the code size.
          boolean lowersCost = minimizeCost(functionState);
          if (!lowersCost) {
            // It shouldn't be inlined; remove it from the list.
            i.remove();
          }
        } else if (!functionState.canRemove()) {
          // Don't bother tracking functions without references that can't be
          // removed.
          i.remove();
        }
      }
    }
docs: Remove entries from the list of candidates that can't be inlined.