| OLD | NEW |
| 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 // A set of selectors we know do not escape the elements inside the | 7 // A set of selectors we know do not escape the elements inside the |
| 8 // list. | 8 // list. |
| 9 Set<String> doesNotEscapeListSet = new Set<String>.from( | 9 Set<String> doesNotEscapeListSet = new Set<String>.from( |
| 10 const <String>[ | 10 const <String>[ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 'runtimeType', | 56 'runtimeType', |
| 57 // from Map. | 57 // from Map. |
| 58 'isEmpty', | 58 'isEmpty', |
| 59 'isNotEmpty', | 59 'isNotEmpty', |
| 60 'length', | 60 'length', |
| 61 'clear', | 61 'clear', |
| 62 'containsKey', | 62 'containsKey', |
| 63 'containsValue' | 63 'containsValue' |
| 64 ]); | 64 ]); |
| 65 | 65 |
| 66 abstract class TracerVisitor implements TypeInformationVisitor { | 66 abstract class TracerVisitor<T extends TypeInformation> |
| 67 final TypeInformation tracedType; | 67 implements TypeInformationVisitor { |
| 68 final T tracedType; |
| 68 final TypeGraphInferrerEngine inferrer; | 69 final TypeGraphInferrerEngine inferrer; |
| 69 final Compiler compiler; | 70 final Compiler compiler; |
| 70 | 71 |
| 71 static const int MAX_ANALYSIS_COUNT = 16; | 72 static const int MAX_ANALYSIS_COUNT = 16; |
| 72 final Setlet<Element> analyzedElements = new Setlet<Element>(); | 73 final Setlet<Element> analyzedElements = new Setlet<Element>(); |
| 73 | 74 |
| 74 TracerVisitor(this.tracedType, inferrer) | 75 TracerVisitor(this.tracedType, inferrer) |
| 75 : this.inferrer = inferrer, this.compiler = inferrer.compiler; | 76 : this.inferrer = inferrer, this.compiler = inferrer.compiler; |
| 76 | 77 |
| 77 // Work list that gets populated with [TypeInformation] that could | 78 // Work list that gets populated with [TypeInformation] that could |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 Element outermost = element.getOutermostEnclosingMemberOrTopLevel(); | 286 Element outermost = element.getOutermostEnclosingMemberOrTopLevel(); |
| 286 return outermost.declaration != element.declaration; | 287 return outermost.declaration != element.declaration; |
| 287 } | 288 } |
| 288 | 289 |
| 289 void visitElementTypeInformation(ElementTypeInformation info) { | 290 void visitElementTypeInformation(ElementTypeInformation info) { |
| 290 Element element = info.element; | 291 Element element = info.element; |
| 291 if (element.isParameter() | 292 if (element.isParameter() |
| 292 && inferrer.isNativeElement(element.enclosingElement)) { | 293 && inferrer.isNativeElement(element.enclosingElement)) { |
| 293 bailout('Passed to a native method'); | 294 bailout('Passed to a native method'); |
| 294 } | 295 } |
| 295 if (info.isClosurized()) { | 296 if (info.isClosurized) { |
| 296 bailout('Returned from a closurized method'); | 297 bailout('Returned from a closurized method'); |
| 297 } | 298 } |
| 298 if (isClosure(info.element)) { | 299 if (isClosure(info.element)) { |
| 299 bailout('Returned from a closure'); | 300 bailout('Returned from a closure'); |
| 300 } | 301 } |
| 301 if (compiler.backend.isNeededForReflection(info.element)) { | 302 if (compiler.backend.isNeededForReflection(info.element)) { |
| 302 bailout('Escape in reflection'); | 303 bailout('Escape in reflection'); |
| 303 } | 304 } |
| 304 if (isParameterOfListAddingMethod(info.element)) { | 305 if (isParameterOfListAddingMethod(info.element)) { |
| 305 // These elements are being handled in | 306 // These elements are being handled in |
| 306 // [visitDynamicCallSiteTypeInformation]. | 307 // [visitDynamicCallSiteTypeInformation]. |
| 307 return; | 308 return; |
| 308 } | 309 } |
| 309 addNewEscapeInformation(info); | 310 addNewEscapeInformation(info); |
| 310 } | 311 } |
| 311 } | 312 } |
| OLD | NEW |