if (Thread.interrupted()) {
throw new InterruptedException();
}
Event optimizeJsEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE_JS);
OptimizerStats stats = new OptimizerStats("Pass " + counter);
// Remove unused functions, possible
stats.add(JsStaticEval.exec(jsProgram));
// Inline JavaScript function invocations
stats.add(JsInliner.exec(jsProgram));
// Remove unused functions, possible
stats.add(JsUnusedFunctionRemover.exec(jsProgram));
// Save the stats to print out after optimizers finish.
allOptimizerStats.add(stats);
optimizeJsEvent.end();
int optimizationLevel = options.getOptimizationLevel();
if ((optimizationLevel < OptionOptimize.OPTIMIZE_LEVEL_MAX && counter > optimizationLevel)
|| !stats.didChange()) {
break;
}
}
if (JProgram.isTracingEnabled()) {
System.out.println("");
System.out.println(" JavaScript Optimization Stats");
System.out.println("");
for (OptimizerStats stats : allOptimizerStats) {
System.out.println(stats.prettyPrint());
}
}
}