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 class ClosureTracerVisitor extends TracerVisitor<ApplyableTypeInformation> { | 7 class ClosureTracerVisitor extends TracerVisitor<ApplyableTypeInformation> { |
8 final Iterable<FunctionElement> tracedElements; | 8 final Iterable<FunctionElement> tracedElements; |
9 final List<CallSiteTypeInformation> callsToAnalyze = | 9 final List<CallSiteTypeInformation> callsToAnalyze = |
10 new List<CallSiteTypeInformation>(); | 10 new List<CallSiteTypeInformation>(); |
11 | 11 |
12 ClosureTracerVisitor(this.tracedElements, tracedType, inferrer) | 12 ClosureTracerVisitor(this.tracedElements, tracedType, inferrer) |
13 : super(tracedType, inferrer); | 13 : super(tracedType, inferrer); |
14 | 14 |
15 void run() { | 15 void run() { |
16 for (FunctionElement e in tracedElements) { | |
17 e.functionSignature.forEachParameter((Element parameter) { | |
18 ElementTypeInformation info = | |
19 inferrer.types.getInferredTypeOf(parameter); | |
20 info.maybeResume(); | |
21 }); | |
22 } | |
23 analyze(); | 16 analyze(); |
24 if (!continueAnalyzing) return; | 17 if (!continueAnalyzing) return; |
25 callsToAnalyze.forEach(analyzeCall); | 18 callsToAnalyze.forEach(analyzeCall); |
26 for(FunctionElement e in tracedElements) { | 19 for(FunctionElement e in tracedElements) { |
27 e.functionSignature.forEachParameter((Element parameter) { | 20 e.functionSignature.forEachParameter((Element parameter) { |
28 ElementTypeInformation info = | 21 ElementTypeInformation info = |
29 inferrer.types.getInferredTypeOf(parameter); | 22 inferrer.types.getInferredTypeOf(parameter); |
30 info.disableInferenceForClosures = false; | 23 info.disableInferenceForClosures = false; |
31 }); | 24 }); |
32 } | 25 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 113 |
121 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 114 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
122 super.visitStaticCallSiteTypeInformation(info); | 115 super.visitStaticCallSiteTypeInformation(info); |
123 if (info.calledElement == tracedElements.first | 116 if (info.calledElement == tracedElements.first |
124 && info.selector != null | 117 && info.selector != null |
125 && info.selector.isGetter) { | 118 && info.selector.isGetter) { |
126 addNewEscapeInformation(info); | 119 addNewEscapeInformation(info); |
127 } | 120 } |
128 } | 121 } |
129 } | 122 } |
OLD | NEW |