com.google.javascript.jscomp.Compiler.stopTracer()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 JavaScript  
字(8.5k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中com.google.javascript.jscomp.Compiler.stopTracer()方法的一些代码示例,展示了Compiler.stopTracer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Compiler.stopTracer()方法的具体详情如下:
包路径:com.google.javascript.jscomp.Compiler
类名称:Compiler
方法名:stopTracer

Compiler.stopTracer介绍

暂无

代码示例

代码示例来源:origin: org.scala-js/closure-compiler-java-6

/**
 * Marks the end of a pass.
 */
void endPass() {
 Preconditions.checkState(currentTracer != null,
   "Tracer should not be null at the end of a pass.");
 stopTracer(currentTracer, currentPassName);
 currentPassName = null;
 currentTracer = null;
 maybeSanityCheck();
}

代码示例来源:origin: com.google.javascript/closure-compiler

@Override
 public CompilerState call() throws Exception {
  Tracer tracer = newTracer(PassNames.DESERIALIZE_COMPILER_STATE);
  logger.fine("Deserializing the CompilerState");
  CompilerState compilerState = (CompilerState) objectInputStream.readObject();
  logger.fine("Finished deserializing CompilerState");
  if (compilerState.typeRegistry != null) {
   logger.fine("Deserializing the TypeRegistry");
   compilerState.typeRegistry.restoreContents(objectInputStream);
   logger.fine("Finished deserializing TypeRegistry");
  }
  stopTracer(tracer, PassNames.DESERIALIZE_COMPILER_STATE);
  return compilerState;
 }
});

代码示例来源:origin: com.google.javascript/closure-compiler

/**
 * Marks the end of a pass.
 */
void endPass(String passName) {
 checkState(currentTracer != null, "Tracer should not be null at the end of a pass.");
 stopTracer(currentTracer, currentPassName);
 afterPass(passName);
 currentPassName = null;
 currentTracer = null;
 maybeRunValidityCheck();
}

代码示例来源:origin: com.google.javascript/closure-compiler

/**
 * Runs custom passes that are designated to run at a particular time.
 */
private void runCustomPasses(CustomPassExecutionTime executionTime) {
 if (options.customPasses != null) {
  Tracer t = newTracer("runCustomPasses");
  try {
   for (CompilerPass p : options.customPasses.get(executionTime)) {
    process(p);
   }
  } finally {
   stopTracer(t, "runCustomPasses");
  }
 }
}

代码示例来源:origin: com.google.javascript/closure-compiler

/**
 * Generates a report of all warnings and errors found during compilation to stderr.
 *
 * <p>Client code must call this method explicitly if it doesn't use one of the convenience
 * methods that do so automatically.
 * <p>Always call this method, even if the compiler throws an exception. The report will include
 * information about the exception.
 */
public void generateReport() {
 Tracer t = newTracer("generateReport");
 errorManager.generateReport();
 stopTracer(t, "generateReport");
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

/**
 * Runs custom passes that are designated to run at a particular time.
 */
private void runCustomPasses(CustomPassExecutionTime executionTime) {
 if (options.customPasses != null) {
  Tracer t = newTracer("runCustomPasses");
  try {
   for (CompilerPass p : options.customPasses.get(executionTime)) {
    process(p);
   }
  } finally {
   stopTracer(t, "runCustomPasses");
  }
 }
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

@Override
 public Void call() throws Exception {
  Tracer tracer = newTracer("orderInputsWithLargeStack");
  try {
   orderInputs();
  } finally {
   stopTracer(tracer, "orderInputsWithLargeStack");
  }
  return null;
 }
});

代码示例来源:origin: com.google.javascript/closure-compiler

private void instrumentForCoverageInternal(boolean instrumentBranchCoverage) {
 Tracer tracer = newTracer("instrumentationPass");
 InstrumentOption instrumentOption = InstrumentOption.LINE_ONLY;
 if (instrumentBranchCoverage) {
  instrumentOption = InstrumentOption.BRANCH_ONLY;
 }
 process(new CoverageInstrumentationPass(this, CoverageReach.ALL, instrumentOption));
 stopTracer(tracer, "instrumentationPass");
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

/** Control Flow Analysis. */
ControlFlowGraph<Node> computeCFG() {
 logger.fine("Computing Control Flow Graph");
 Tracer tracer = newTracer("computeCFG");
 ControlFlowAnalysis cfa = new ControlFlowAnalysis(this, true, false);
 process(cfa);
 stopTracer(tracer, "computeCFG");
 return cfa.getCfg();
}

代码示例来源:origin: com.google.javascript/closure-compiler

void orderInputsWithLargeStack() {
 runInCompilerThread(
   () -> {
    Tracer tracer = newTracer("orderInputsWithLargeStack");
    try {
     orderInputs();
    } finally {
     stopTracer(tracer, "orderInputsWithLargeStack");
    }
    return null;
   });
}

代码示例来源:origin: com.google.javascript/closure-compiler

/** Control Flow Analysis. */
ControlFlowGraph<Node> computeCFG() {
 logger.fine("Computing Control Flow Graph");
 Tracer tracer = newTracer("computeCFG");
 ControlFlowAnalysis cfa = new ControlFlowAnalysis(this, true, false);
 process(cfa);
 stopTracer(tracer, "computeCFG");
 return cfa.getCfg();
}

代码示例来源:origin: com.google.javascript/closure-compiler

@GwtIncompatible("ObjectOutputStream")
public void saveState(OutputStream outputStream) throws IOException {
 // Do not close the outputstream, caller is responsible for closing it.
 final ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
 runInCompilerThread(
   () -> {
    Tracer tracer = newTracer("serializeCompilerState");
    objectOutputStream.writeObject(new CompilerState(Compiler.this));
    if (typeRegistry != null) {
     typeRegistry.saveContents(objectOutputStream);
    }
    stopTracer(tracer, "serializeCompilerState");
    return null;
   });
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

@Override
 public String[] call() throws Exception {
  Tracer tracer = newTracer("toSourceArray");
  try {
   int numInputs = inputs.size();
   String[] sources = new String[numInputs];
   CodeBuilder cb = new CodeBuilder();
   for (int i = 0; i < numInputs; i++) {
    Node scriptNode = inputs.get(i).getAstRoot(Compiler.this);
    cb.reset();
    toSource(cb, i, scriptNode);
    sources[i] = cb.toString();
   }
   return sources;
  } finally {
   stopTracer(tracer, "toSourceArray");
  }
 }
});

代码示例来源:origin: org.scala-js/closure-compiler-java-6

public void whitespaceOnlyPasses() {
 Tracer t = newTracer("runWhitespaceOnlyPasses");
 try {
  for (PassFactory pf : getPassConfig().getWhitespaceOnlyPasses()) {
   pf.create(this).process(externsRoot, jsRoot);
  }
 } finally {
  stopTracer(t, "runWhitespaceOnlyPasses");
 }
}

代码示例来源:origin: com.google.javascript/closure-compiler

public void whitespaceOnlyPasses() {
 runCustomPasses(CustomPassExecutionTime.BEFORE_CHECKS);
 Tracer t = newTracer("runWhitespaceOnlyPasses");
 try {
  for (PassFactory pf : getPassConfig().getWhitespaceOnlyPasses()) {
   pf.create(this).process(externsRoot, jsRoot);
  }
 } finally {
  stopTracer(t, "runWhitespaceOnlyPasses");
 }
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

/**
 * Compiles a list of inputs.
 */
public <T1 extends SourceFile, T2 extends SourceFile> Result compile(
  List<T1> externs, List<T2> inputs, CompilerOptions options) {
 // The compile method should only be called once.
 Preconditions.checkState(jsRoot == null);
 try {
  init(externs, inputs, options);
  if (hasErrors()) {
   return getResult();
  }
  return compile();
 } finally {
  Tracer t = newTracer("generateReport");
  errorManager.generateReport();
  stopTracer(t, "generateReport");
 }
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

/**
 * Compiles a list of modules.
 */
public <T extends SourceFile> Result compileModules(List<T> externs,
  List<JSModule> modules, CompilerOptions options) {
 // The compile method should only be called once.
 Preconditions.checkState(jsRoot == null);
 try {
  initModules(externs, modules, options);
  if (hasErrors()) {
   return getResult();
  }
  return compile();
 } finally {
  Tracer t = newTracer("generateReport");
  errorManager.generateReport();
  stopTracer(t, "generateReport");
 }
}

代码示例来源:origin: com.google.javascript/closure-compiler

public void transpileAndDontCheck() {
 Tracer t = newTracer("runTranspileOnlyPasses");
 try {
  for (PassFactory pf : getPassConfig().getTranspileOnlyPasses()) {
   if (hasErrors()) {
    return;
   }
   pf.create(this).process(externsRoot, jsRoot);
  }
 } finally {
  stopTracer(t, "runTranspileOnlyPasses");
 }
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

@Override
 public String call() throws Exception {
  Tracer tracer = newTracer("toSource");
  try {
   CodeBuilder cb = new CodeBuilder();
   if (jsRoot != null) {
    int i = 0;
    for (Node scriptNode = jsRoot.getFirstChild();
       scriptNode != null;
       scriptNode = scriptNode.getNext()) {
     toSource(cb, i++, scriptNode);
    }
   }
   return cb.toString();
  } finally {
   stopTracer(tracer, "toSource");
  }
 }
});

代码示例来源:origin: com.google.javascript/closure-compiler

/**
 * Converts the parse tree for each input back to JS code.
 */
public String[] toSourceArray() {
 return runInCompilerThread(
   () -> {
    Tracer tracer = newTracer("toSourceArray");
    try {
     int numInputs = moduleGraph.getInputCount();
     String[] sources = new String[numInputs];
     CodeBuilder cb = new CodeBuilder();
     int i = 0;
     for (CompilerInput input : moduleGraph.getAllInputs()) {
      Node scriptNode = input.getAstRoot(Compiler.this);
      cb.reset();
      toSource(cb, i, scriptNode);
      sources[i] = cb.toString();
      i++;
     }
     return sources;
    } finally {
     stopTracer(tracer, "toSourceArray");
    }
   });
}

相关文章

Compiler类方法