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

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

Issue 10991034: Order the parameters of a function at the definition site. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 js.Block body = new js.Block(<js.Statement>[]); 151 js.Block body = new js.Block(<js.Statement>[]);
152 if (codegen.setup != null) body.statements.add(codegen.setup); 152 if (codegen.setup != null) body.statements.add(codegen.setup);
153 body.statements.add(codegen.body); 153 body.statements.add(codegen.body);
154 js.Fun fun = 154 js.Fun fun =
155 buildJavaScriptFunction(work.element, codegen.newParameters, body); 155 buildJavaScriptFunction(work.element, codegen.newParameters, body);
156 return prettyPrint(fun); 156 return prettyPrint(fun);
157 }); 157 });
158 } 158 }
159 159
160 Map<Element, String> getParameterNames(WorkItem work) { 160 Map<Element, String> getParameterNames(WorkItem work) {
161 // Make sure the map preserves insertion order, so that fetching
162 // the values will keep the order of parameters.
161 Map<Element, String> parameterNames = new LinkedHashMap<Element, String>(); 163 Map<Element, String> parameterNames = new LinkedHashMap<Element, String>();
162 FunctionElement function = work.element.implementation; 164 FunctionElement function = work.element.implementation;
163 165
164 // The dom/html libraries have inline JS code that reference 166 // The dom/html libraries have inline JS code that reference
165 // parameter names directly. Long-term such code will be rejected. 167 // parameter names directly. Long-term such code will be rejected.
166 // Now, just don't mangle the parameter name. 168 // Now, just don't mangle the parameter name.
167 function.computeSignature(compiler).forEachParameter((Element element) { 169 FunctionSignature signature = function.computeSignature(compiler);
170 signature.orderedForEachParameter((Element element) {
168 parameterNames[element] = function.isNative() 171 parameterNames[element] = function.isNative()
169 ? element.name.slowToString() 172 ? element.name.slowToString()
170 : JsNames.getValid('${element.name.slowToString()}'); 173 : JsNames.getValid('${element.name.slowToString()}');
171 }); 174 });
172 return parameterNames; 175 return parameterNames;
173 } 176 }
174 } 177 }
175 178
176 typedef void ElementAction(Element element); 179 typedef void ElementAction(Element element);
177 180
(...skipping 2816 matching lines...) Expand 10 before | Expand all | Expand 10 after
2994 if (leftType.canBeNull() && rightType.canBeNull()) { 2997 if (leftType.canBeNull() && rightType.canBeNull()) {
2995 if (left.isConstantNull() || right.isConstantNull() || 2998 if (left.isConstantNull() || right.isConstantNull() ||
2996 (leftType.isPrimitive() && leftType == rightType)) { 2999 (leftType.isPrimitive() && leftType == rightType)) {
2997 return '=='; 3000 return '==';
2998 } 3001 }
2999 return null; 3002 return null;
3000 } else { 3003 } else {
3001 return '==='; 3004 return '===';
3002 } 3005 }
3003 } 3006 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/universe/universe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698