| 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 library compiler.src.inferrer.node_tracer; | 5 library compiler.src.inferrer.node_tracer; |
| 6 | 6 |
| 7 import '../common/names.dart' show Identifiers; | 7 import '../common/names.dart' show Identifiers; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../types/types.dart' show ContainerTypeMask, MapTypeMask; | 10 import '../types/types.dart' show ContainerTypeMask, MapTypeMask; |
| 11 import '../util/util.dart' show Setlet; | 11 import '../util/util.dart' show Setlet; |
| 12 import 'debug.dart' as debug; | 12 import 'debug.dart' as debug; |
| 13 import 'type_graph_inferrer.dart' show TypeGraphInferrerEngine; | 13 import 'inferrer_engine.dart'; |
| 14 import 'type_graph_nodes.dart'; | 14 import 'type_graph_nodes.dart'; |
| 15 | 15 |
| 16 // A set of selectors we know do not escape the elements inside the | 16 // A set of selectors we know do not escape the elements inside the |
| 17 // list. | 17 // list. |
| 18 Set<String> doesNotEscapeListSet = new Set<String>.from(const <String>[ | 18 Set<String> doesNotEscapeListSet = new Set<String>.from(const <String>[ |
| 19 // From Object. | 19 // From Object. |
| 20 '==', | 20 '==', |
| 21 'hashCode', | 21 'hashCode', |
| 22 'toString', | 22 'toString', |
| 23 'noSuchMethod', | 23 'noSuchMethod', |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 'length', | 65 'length', |
| 66 'clear', | 66 'clear', |
| 67 'containsKey', | 67 'containsKey', |
| 68 'containsValue', | 68 'containsValue', |
| 69 '[]=', | 69 '[]=', |
| 70 // [keys] only allows key values to escape, which we do not track. | 70 // [keys] only allows key values to escape, which we do not track. |
| 71 'keys' | 71 'keys' |
| 72 ]); | 72 ]); |
| 73 | 73 |
| 74 /// Common logic to trace a value through the type inference graph nodes. | 74 /// Common logic to trace a value through the type inference graph nodes. |
| 75 abstract class TracerVisitor<T extends TypeInformation> | 75 abstract class TracerVisitor implements TypeInformationVisitor { |
| 76 implements TypeInformationVisitor { | 76 final TypeInformation tracedType; |
| 77 final T tracedType; | 77 final InferrerEngine inferrer; |
| 78 final TypeGraphInferrerEngine inferrer; | |
| 79 final Compiler compiler; | 78 final Compiler compiler; |
| 80 | 79 |
| 81 static const int MAX_ANALYSIS_COUNT = 16; | 80 static const int MAX_ANALYSIS_COUNT = 16; |
| 82 final Setlet<Element> analyzedElements = new Setlet<Element>(); | 81 final Setlet<Element> analyzedElements = new Setlet<Element>(); |
| 83 | 82 |
| 84 TracerVisitor(this.tracedType, TypeGraphInferrerEngine inferrer) | 83 TracerVisitor(this.tracedType, InferrerEngine inferrer) |
| 85 : this.inferrer = inferrer, | 84 : this.inferrer = inferrer, |
| 86 this.compiler = inferrer.compiler; | 85 this.compiler = inferrer.compiler; |
| 87 | 86 |
| 88 // Work list that gets populated with [TypeInformation] that could | 87 // Work list that gets populated with [TypeInformation] that could |
| 89 // contain the container. | 88 // contain the container. |
| 90 final List<TypeInformation> workList = <TypeInformation>[]; | 89 final List<TypeInformation> workList = <TypeInformation>[]; |
| 91 | 90 |
| 92 // Work list of lists to analyze after analyzing the users of a | 91 // Work list of lists to analyze after analyzing the users of a |
| 93 // [TypeInformation]. We know the [tracedType] has been stored in these | 92 // [TypeInformation]. We know the [tracedType] has been stored in these |
| 94 // lists and we must check how it escapes from these lists. | 93 // lists and we must check how it escapes from these lists. |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 401 } |
| 403 if (isParameterOfListAddingMethod(info.element) || | 402 if (isParameterOfListAddingMethod(info.element) || |
| 404 isParameterOfMapAddingMethod(info.element)) { | 403 isParameterOfMapAddingMethod(info.element)) { |
| 405 // These elements are being handled in | 404 // These elements are being handled in |
| 406 // [visitDynamicCallSiteTypeInformation]. | 405 // [visitDynamicCallSiteTypeInformation]. |
| 407 return; | 406 return; |
| 408 } | 407 } |
| 409 addNewEscapeInformation(info); | 408 addNewEscapeInformation(info); |
| 410 } | 409 } |
| 411 } | 410 } |
| OLD | NEW |