Enabled class name minification in production mode. Reduces removes 52K (optimzed) from swarm.

Review URL: http://codereview.chromium.org//8252006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@401 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
johnlenz@google.com 2011-10-13 16:16:33 +00:00
parent b69b4200c8
commit 145154cf2b
3 changed files with 19 additions and 8 deletions

View file

@ -51,7 +51,9 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration {
return new DartIsolateStubGenerator(compilerOptions.getIsolateStubClasses(),
compilerOptions.getIsolateStubOutputFile());
} else if (compilerOptions.shouldOptimize()) {
return new ClosureJsBackend(compilerOptions.generateHumanReadableOutput());
return new ClosureJsBackend(
compilerOptions.developerModeChecks(),
compilerOptions.generateHumanReadableOutput());
} else {
return new JavascriptBackend();
}

View file

@ -82,28 +82,33 @@ public class ClosureJsBackend extends AbstractJsBackend {
// Validate the generated JavaScript
private final boolean validate;
// Whether the generated code is "checked".
private final boolean checkedMode;
public ClosureJsBackend() {
this(false);
this(false, false);
}
/**
* @param generateHumanReadableOutput - generates human readable javascript output.
*/
public ClosureJsBackend(boolean generateHumanReadableOutput) {
public ClosureJsBackend(boolean checkedMode, boolean generateHumanReadableOutput) {
// Current default settings
this(false, true, false, true, generateHumanReadableOutput);
this(false, true, false, true, checkedMode, generateHumanReadableOutput);
}
public ClosureJsBackend(boolean fastOutput,
boolean produceSourceMap,
boolean incremental,
boolean validate,
boolean checkedMode,
boolean generateHumanReadableOutput) {
this.fastOutput = fastOutput;
this.produceSourceMap = produceSourceMap;
// can't currently produce a valid source map incrementally
this.incremental = incremental && !produceSourceMap;
this.validate = validate;
this.checkedMode = checkedMode;
this.generateHumanReadableOutput = generateHumanReadableOutput;
}
@ -487,9 +492,11 @@ public class ClosureJsBackend extends AbstractJsBackend {
/*
* NOTE: We turn this off because TypeErrors or anything that relies on a type name will fail
* due to the renaming.
* due to the class renaming.
*/
options.setReplaceIdGenerators(false);
if (checkedMode) {
options.setReplaceIdGenerators(false);
}
return options;
}
@ -576,7 +583,7 @@ public class ClosureJsBackend extends AbstractJsBackend {
* @return a mutable list
* @throws IOException
*/
public static List<JSSourceFile> getDefaultExterns() throws IOException {
private static List<JSSourceFile> getDefaultExterns() throws IOException {
Class<ClosureJsBackend> clazz = ClosureJsBackend.class;
InputStream input = clazz.getResourceAsStream(
"/com/google/javascript/jscomp/externs.zip");

View file

@ -337,7 +337,9 @@ public class DartRunner {
final DartRunnerOptions options, DartCompilerListener listener) throws RunnerError {
Backend backend;
if (options.shouldOptimize()) {
backend = new ClosureJsBackend(options.generateHumanReadableOutput());
backend = new ClosureJsBackend(
options.developerModeChecks(),
options.generateHumanReadableOutput());
} else {
backend = new JavascriptBackend();
}