JS backend: added the ability to turn off the inline optimization.

This commit is contained in:
Zalim Bashorov
2014-08-14 22:50:11 +04:00
parent 338789664c
commit 0e075c7d5f
12 changed files with 72 additions and 28 deletions
@@ -38,6 +38,9 @@ public abstract class CommonCompilerArguments {
@Argument(value = "X", description = "Print a synopsis of advanced options")
public boolean extraHelp;
@Argument(value = "Xno-inline", description = "Disable method inlining")
public boolean noInline;
public List<String> freeArgs = new SmartList<String>();
@NotNull
@@ -63,9 +63,6 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
@Argument(value = "Xno-param-assertions", description = "Don't generate not-null assertions on parameters of methods accessible from Java")
public boolean noParamAssertions;
@Argument(value = "Xno-inline", description = "Disable method inlining")
public boolean noInline;
@Argument(value = "Xno-optimize", description = "Disable optimizations")
public boolean noOptimize;
@@ -198,12 +198,14 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
}
EcmaVersion ecmaVersion = EcmaVersion.defaultVersion();
String moduleId = FileUtil.getNameWithoutExtension(new File(arguments.outputFile));
boolean inlineEnabled = !arguments.noInline;
if (arguments.libraryFiles != null) {
return new LibrarySourcesConfig(project, moduleId, Arrays.asList(arguments.libraryFiles), ecmaVersion, arguments.sourceMap);
return new LibrarySourcesConfig(project, moduleId, Arrays.asList(arguments.libraryFiles), ecmaVersion, arguments.sourceMap, inlineEnabled);
}
else {
// lets discover the JS library definitions on the classpath
return new ClassPathLibraryDefintionsConfig(project, moduleId, ecmaVersion, arguments.sourceMap);
return new ClassPathLibraryDefintionsConfig(project, moduleId, ecmaVersion, arguments.sourceMap, inlineEnabled);
}
}