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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/inferrer/container_tracer.dart

Issue 82953002: Inline the fixed array constructor manually in the SSA builder. Also track whether a fixed array ev… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 type_graph_inferrer; 5 part of type_graph_inferrer;
6 6
7 /** 7 /**
8 * A set of selector names that [List] implements, that we know do not 8 * A set of selector names that [List] implements, that we know do not
9 * change the element type of the list, or let the list escape to code 9 * change the element type of the list, or let the list escape to code
10 * that might change the element type. 10 * that might change the element type.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 // The set of [TypeInformation] where the traced container could 135 // The set of [TypeInformation] where the traced container could
136 // flow in, and operations done on them. 136 // flow in, and operations done on them.
137 final Setlet<TypeInformation> allUsers = new Setlet<TypeInformation>(); 137 final Setlet<TypeInformation> allUsers = new Setlet<TypeInformation>();
138 138
139 // The list of found assignments to the container. 139 // The list of found assignments to the container.
140 final List<TypeInformation> assignments = <TypeInformation>[]; 140 final List<TypeInformation> assignments = <TypeInformation>[];
141 141
142 bool enableLengthTracking = true; 142 bool enableLengthTracking = true;
143 bool continueAnalyzing = true; 143 bool continueAnalyzing = true;
144 144 bool checksGrowable = false;
kasperl 2013/11/25 08:16:44 Is this always !enableLengthTracking? Should you u
ngeoffray 2013/11/25 08:33:31 Yes, it is always !enableLengthTracking. I combine
145
145 static const int MAX_ANALYSIS_COUNT = 16; 146 static const int MAX_ANALYSIS_COUNT = 16;
146 final Setlet<Element> analyzedElements = new Setlet<Element>(); 147 final Setlet<Element> analyzedElements = new Setlet<Element>();
147 148
148 ContainerTracerVisitor(this.container, inferrer) 149 ContainerTracerVisitor(this.container, inferrer)
149 : this.inferrer = inferrer, this.compiler = inferrer.compiler; 150 : this.inferrer = inferrer, this.compiler = inferrer.compiler;
150 151
151 List<TypeInformation> run() { 152 List<TypeInformation> run() {
152 // Collect the [TypeInformation] where the container can flow in, 153 // Collect the [TypeInformation] where the container can flow in,
153 // as well as the operations done on all these [TypeInformation]s. 154 // as well as the operations done on all these [TypeInformation]s.
154 List<TypeInformation> workList = <TypeInformation>[]; 155 List<TypeInformation> workList = <TypeInformation>[];
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 243 }
243 } else if (selector.isIndexSet()) { 244 } else if (selector.isIndexSet()) {
244 assignments.add(info.arguments.positional[1]); 245 assignments.add(info.arguments.positional[1]);
245 } else if (!selector.isIndex()) { 246 } else if (!selector.isIndex()) {
246 bailout('Used in a not-ok selector'); 247 bailout('Used in a not-ok selector');
247 return; 248 return;
248 } 249 }
249 } 250 }
250 if (!doNotChangeLengthSelectorsSet.contains(selectorName)) { 251 if (!doNotChangeLengthSelectorsSet.contains(selectorName)) {
251 enableLengthTracking = false; 252 enableLengthTracking = false;
253 checksGrowable = true;
252 } 254 }
253 if (selectorName == 'length' && selector.isSetter()) { 255 if (selectorName == 'length' && selector.isSetter()) {
254 enableLengthTracking = false; 256 enableLengthTracking = false;
257 checksGrowable = true;
255 assignments.add(inferrer.types.nullType); 258 assignments.add(inferrer.types.nullType);
256 } 259 }
257 } else if (selector.isCall() 260 } else if (selector.isCall()
258 && !info.targets.every((element) => element.isFunction())) { 261 && !info.targets.every((element) => element.isFunction())) {
259 bailout('Passed to a closure'); 262 bailout('Passed to a closure');
260 return; 263 return;
261 } 264 }
262 } 265 }
263 266
264 bool isClosure(Element element) { 267 bool isClosure(Element element) {
265 if (!element.isFunction()) return false; 268 if (!element.isFunction()) return false;
266 Element outermost = element.getOutermostEnclosingMemberOrTopLevel(); 269 Element outermost = element.getOutermostEnclosingMemberOrTopLevel();
267 return outermost.declaration != element.declaration; 270 return outermost.declaration != element.declaration;
268 } 271 }
269 272
270 visitElementTypeInformation(ElementTypeInformation info) { 273 visitElementTypeInformation(ElementTypeInformation info) {
271 if (isClosure(info.element)) { 274 if (isClosure(info.element)) {
272 bailout('Returned from a closure'); 275 bailout('Returned from a closure');
273 } 276 }
274 } 277 }
275 } 278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698