Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10901002: Hook up the --minify option in dart2js and use it to get rid of unnecessary whitespace inside funct… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/js_backend/backend.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 6
7 final JavaScriptBackend backend; 7 final JavaScriptBackend backend;
8 8
9 SsaCodeGeneratorTask(JavaScriptBackend backend) 9 SsaCodeGeneratorTask(JavaScriptBackend backend)
10 : this.backend = backend, 10 : this.backend = backend,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 compiler, buffer, element, codeString, parametersString); 71 compiler, buffer, element, codeString, parametersString);
72 js.Node nativeCode = new js.LiteralStatement(buffer.toString()); 72 js.Node nativeCode = new js.LiteralStatement(buffer.toString());
73 body = new js.Block(<js.Statement>[nativeCode]); 73 body = new js.Block(<js.Statement>[nativeCode]);
74 } else { 74 } else {
75 body = codegen.body; 75 body = codegen.body;
76 } 76 }
77 js.Fun fun = buildJavaScriptFunction(element, parameters, body); 77 js.Fun fun = buildJavaScriptFunction(element, parameters, body);
78 return prettyPrint(fun, work.element); 78 return prettyPrint(fun, work.element);
79 }); 79 });
80 } 80 }
81 81
82 void addTypeParameters(Element element, 82 void addTypeParameters(Element element,
83 List<js.Parameter> parameters, 83 List<js.Parameter> parameters,
84 Map<Element, String> parameterNames) { 84 Map<Element, String> parameterNames) {
85 if (element.isFactoryConstructor() || element.isGenerativeConstructor()) { 85 if (element.isFactoryConstructor() || element.isGenerativeConstructor()) {
86 ClassElement cls = element.enclosingElement; 86 ClassElement cls = element.enclosingElement;
87 cls.typeVariables.forEach((TypeVariableType typeVariable) { 87 cls.typeVariables.forEach((TypeVariableType typeVariable) {
88 String name = typeVariable.element.name.slowToString(); 88 String name = typeVariable.element.name.slowToString();
89 String prefix = ''; 89 String prefix = '';
90 // Avoid collisions with real parameters of the method. 90 // Avoid collisions with real parameters of the method.
91 do { 91 do {
92 name = JsNames.getValid('$prefix$name'); 92 name = JsNames.getValid('$prefix$name');
93 prefix = '\$$prefix'; 93 prefix = '\$$prefix';
94 } while (parameterNames.containsValue(name)); 94 } while (parameterNames.containsValue(name));
95 parameterNames[typeVariable.element] = name; 95 parameterNames[typeVariable.element] = name;
96 parameters.add(new js.Parameter(name)); 96 parameters.add(new js.Parameter(name));
97 }); 97 });
98 } 98 }
99 } 99 }
100 100
101 CodeBuffer generateBailoutMethod(WorkItem work, HGraph graph) { 101 CodeBuffer generateBailoutMethod(WorkItem work, HGraph graph) {
(...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after
2925 if (leftType.canBeNull() && rightType.canBeNull()) { 2925 if (leftType.canBeNull() && rightType.canBeNull()) {
2926 if (left.isConstantNull() || right.isConstantNull() || 2926 if (left.isConstantNull() || right.isConstantNull() ||
2927 (leftType.isPrimitive() && leftType == rightType)) { 2927 (leftType.isPrimitive() && leftType == rightType)) {
2928 return '=='; 2928 return '==';
2929 } 2929 }
2930 return null; 2930 return null;
2931 } else { 2931 } else {
2932 return '==='; 2932 return '===';
2933 } 2933 }
2934 } 2934 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/js_backend/backend.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698