code: boolean inliningLowersCost(
        JSModule fnModule, Node fnNode, Collection<? extends Reference> refs,
        Set<String> namesToAlias, boolean isRemovable, boolean referencesThis) {
      int referenceCount = refs.size();
      if (referenceCount == 0) {
        return true;
      }
  
      int referencesUsingBlockInlining = 0;
  
      boolean checkModules = isRemovable && fnModule != null;
      JSModuleGraph moduleGraph = compiler.getModuleGraph();
  
      for (Reference ref : refs) {
        if (ref.mode == InliningMode.BLOCK) {
          referencesUsingBlockInlining++;
        }
  
        // Check if any of the references cross the module boundaries.
        if (checkModules && ref.module != null) {
          if (ref.module != fnModule && !moduleGraph.dependsOn(ref.module, fnModule)) {
            // Calculate the cost as if the function were non-removable,
            // if it still lowers the cost inline it.
            isRemovable = false;
            checkModules = false;  // no need to check additional modules.
          }
        }
      }
  
      int referencesUsingDirectInlining = referenceCount - referencesUsingBlockInlining;
  
      // Don't bother calculating the cost of function for simple functions where
      // possible.
      // However, when inlining a complex function, even a single reference may be
      // larger than the original function if there are many returns (resulting
      // in additional assignments) or many parameters that need to be aliased
      // so use the cost estimating.
      if (referenceCount == 1 && isRemovable && referencesUsingDirectInlining == 1) {
        return true;
      }
  
      int callCost = estimateCallCost(fnNode, referencesThis);
      int overallCallCost = callCost * referenceCount;
  
      int costDeltaDirect = inlineCostDelta(fnNode, namesToAlias, InliningMode.DIRECT);
      int costDeltaBlock = inlineCostDelta(fnNode, namesToAlias, InliningMode.BLOCK);
  
      return doesLowerCost(fnNode, overallCallCost,
          referencesUsingDirectInlining, costDeltaDirect,
          referencesUsingBlockInlining, costDeltaBlock,
          isRemovable);
    }
docs: Determine if inlining the function is likely to reduce the code size.
  @param namesToAlias