| 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>(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (!info.targets.every((element) => element.isFunction)) { | 94 if (!info.targets.every((element) => element.isFunction)) { |
| 95 bailout('Passed to a closure'); | 95 bailout('Passed to a closure'); |
| 96 } | 96 } |
| 97 if (info.targets.any(checkIfFunctionApply)) { | 97 if (info.targets.any(checkIfFunctionApply)) { |
| 98 tagAsFunctionApplyTarget("dynamic call"); | 98 tagAsFunctionApplyTarget("dynamic call"); |
| 99 } | 99 } |
| 100 } else if (info.targets.any((element) => checkIfCurrentUser(element))) { | 100 } else if (info.targets.any((element) => checkIfCurrentUser(element))) { |
| 101 registerCallForLaterAnalysis(info); | 101 registerCallForLaterAnalysis(info); |
| 102 } | 102 } |
| 103 } else if (info.selector.isGetter && | 103 } else if (info.selector.isGetter && |
| 104 info.selector.name == Compiler.CALL_OPERATOR_NAME) { | 104 info.selector.memberName == Names.call) { |
| 105 // We are potentially tearing off ourself here | 105 // We are potentially tearing off ourself here |
| 106 addNewEscapeInformation(info); | 106 addNewEscapeInformation(info); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 class StaticTearOffClosureTracerVisitor extends ClosureTracerVisitor { | 111 class StaticTearOffClosureTracerVisitor extends ClosureTracerVisitor { |
| 112 StaticTearOffClosureTracerVisitor(tracedElement, tracedType, inferrer) | 112 StaticTearOffClosureTracerVisitor(tracedElement, tracedType, inferrer) |
| 113 : super([tracedElement], tracedType, inferrer); | 113 : super([tracedElement], tracedType, inferrer); |
| 114 | 114 |
| 115 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 115 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
| 116 super.visitStaticCallSiteTypeInformation(info); | 116 super.visitStaticCallSiteTypeInformation(info); |
| 117 if (info.calledElement == tracedElements.first | 117 if (info.calledElement == tracedElements.first |
| 118 && info.selector != null | 118 && info.selector != null |
| 119 && info.selector.isGetter) { | 119 && info.selector.isGetter) { |
| 120 addNewEscapeInformation(info); | 120 addNewEscapeInformation(info); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 } | 123 } |
| OLD | NEW |