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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 12753003: Recognize const/fixed/growable arrays in simple types inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 * 3263 *
3264 * Invariant: [type] must not be malformed in checked mode. 3264 * Invariant: [type] must not be malformed in checked mode.
3265 */ 3265 */
3266 visitNewSend(Send node, InterfaceType type) { 3266 visitNewSend(Send node, InterfaceType type) {
3267 assert(invariant(node, 3267 assert(invariant(node,
3268 !compiler.enableTypeAssertions || !type.isMalformed, 3268 !compiler.enableTypeAssertions || !type.isMalformed,
3269 message: '$type is malformed in checked mode')); 3269 message: '$type is malformed in checked mode'));
3270 bool isListConstructor = false; 3270 bool isListConstructor = false;
3271 computeType(element) { 3271 computeType(element) {
3272 Element originalElement = elements[node]; 3272 Element originalElement = elements[node];
3273 if (identical(originalElement.getEnclosingClass(), compiler.listClass)) { 3273 if (Elements.isFixedListConstructorCall(
3274 originalElement, node, compiler)) {
3274 isListConstructor = true; 3275 isListConstructor = true;
3275 if (node.arguments.isEmpty) { 3276 return HType.FIXED_ARRAY;
3276 return HType.EXTENDABLE_ARRAY; 3277 } else if (Elements.isGrowableListConstructorCall(
3277 } else { 3278 originalElement, node, compiler)) {
3278 return HType.MUTABLE_ARRAY; 3279 isListConstructor = true;
kasperl 2013/03/11 08:40:57 Was this just pessimistic before?
ngeoffray 2013/03/11 08:59:57 Yes it was. But the optimizers were putting it bac
3279 } 3280 return HType.EXTENDABLE_ARRAY;
3280 } else if (element.isGenerativeConstructor()) { 3281 } else if (element.isGenerativeConstructor()) {
3281 ClassElement cls = element.getEnclosingClass(); 3282 ClassElement cls = element.getEnclosingClass();
3282 return new HType.nonNullExact(cls.thisType, compiler); 3283 return new HType.nonNullExact(cls.thisType, compiler);
3283 } else { 3284 } else {
3284 return HType.UNKNOWN; 3285 return HType.UNKNOWN;
3285 } 3286 }
3286 } 3287 }
3287 3288
3288 Element constructor = elements[node]; 3289 Element constructor = elements[node];
3289 Selector selector = elements.getSelector(node); 3290 Selector selector = elements.getSelector(node);
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
5096 new HSubGraphBlockInformation(elseBranch.graph)); 5097 new HSubGraphBlockInformation(elseBranch.graph));
5097 5098
5098 HBasicBlock conditionStartBlock = conditionBranch.block; 5099 HBasicBlock conditionStartBlock = conditionBranch.block;
5099 conditionStartBlock.setBlockFlow(info, joinBlock); 5100 conditionStartBlock.setBlockFlow(info, joinBlock);
5100 SubGraph conditionGraph = conditionBranch.graph; 5101 SubGraph conditionGraph = conditionBranch.graph;
5101 HIf branch = conditionGraph.end.last; 5102 HIf branch = conditionGraph.end.last;
5102 assert(branch is HIf); 5103 assert(branch is HIf);
5103 branch.blockInformation = conditionStartBlock.blockFlow; 5104 branch.blockInformation = conditionStartBlock.blockFlow;
5104 } 5105 }
5105 } 5106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698