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.closure_tracer; | 5 library compiler.src.inferrer.closure_tracer; |
6 | 6 |
7 import '../common/names.dart' show Names; | 7 import '../common/names.dart' show Names; |
8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
9 import '../types/types.dart' show TypeMask; | 9 import '../types/types.dart' show TypeMask; |
10 import '../universe/selector.dart' show Selector; | 10 import '../universe/selector.dart' show Selector; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 info.arguments != null && | 87 info.arguments != null && |
88 info.arguments.contains(currentUser)) { | 88 info.arguments.contains(currentUser)) { |
89 _tagAsFunctionApplyTarget("static call"); | 89 _tagAsFunctionApplyTarget("static call"); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 bool _checkIfCurrentUser(element) => | 93 bool _checkIfCurrentUser(element) => |
94 inferrer.types.getInferredTypeOf(element) == currentUser; | 94 inferrer.types.getInferredTypeOf(element) == currentUser; |
95 | 95 |
96 bool _checkIfFunctionApply(element) => | 96 bool _checkIfFunctionApply(element) => |
97 compiler.functionApplyMethod == element; | 97 compiler.commonElements.isFunctionApplyMethod(element); |
98 | 98 |
99 @override | 99 @override |
100 visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) { | 100 visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) { |
101 super.visitDynamicCallSiteTypeInformation(info); | 101 super.visitDynamicCallSiteTypeInformation(info); |
102 if (info.selector.isCall) { | 102 if (info.selector.isCall) { |
103 if (info.arguments.contains(currentUser)) { | 103 if (info.arguments.contains(currentUser)) { |
104 if (!info.targets.every((element) => element.isFunction)) { | 104 if (!info.targets.every((element) => element.isFunction)) { |
105 bailout('Passed to a closure'); | 105 bailout('Passed to a closure'); |
106 } | 106 } |
107 if (info.targets.any(_checkIfFunctionApply)) { | 107 if (info.targets.any(_checkIfFunctionApply)) { |
(...skipping 17 matching lines...) Expand all Loading... |
125 @override | 125 @override |
126 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 126 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
127 super.visitStaticCallSiteTypeInformation(info); | 127 super.visitStaticCallSiteTypeInformation(info); |
128 if (info.calledElement == tracedElements.first && | 128 if (info.calledElement == tracedElements.first && |
129 info.selector != null && | 129 info.selector != null && |
130 info.selector.isGetter) { | 130 info.selector.isGetter) { |
131 addNewEscapeInformation(info); | 131 addNewEscapeInformation(info); |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
OLD | NEW |