| 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 '../js_backend/backend_helpers.dart'; | 9 import '../js_backend/backend.dart' show JavaScriptBackend; |
| 10 import '../types/types.dart' show TypeMask; | 10 import '../types/types.dart' show TypeMask; |
| 11 import '../universe/selector.dart' show Selector; | 11 import '../universe/selector.dart' show Selector; |
| 12 import 'debug.dart' as debug; | 12 import 'debug.dart' as debug; |
| 13 import 'inferrer_engine.dart'; | 13 import 'inferrer_engine.dart'; |
| 14 import 'node_tracer.dart'; | 14 import 'node_tracer.dart'; |
| 15 import 'type_graph_nodes.dart'; | 15 import 'type_graph_nodes.dart'; |
| 16 | 16 |
| 17 class ClosureTracerVisitor extends TracerVisitor { | 17 class ClosureTracerVisitor extends TracerVisitor { |
| 18 final Iterable<FunctionElement> tracedElements; | 18 final Iterable<FunctionElement> tracedElements; |
| 19 final List<CallSiteTypeInformation> _callsToAnalyze = | 19 final List<CallSiteTypeInformation> _callsToAnalyze = |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 bailout('Passed to a closure'); | 71 bailout('Passed to a closure'); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 @override | 75 @override |
| 76 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 76 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
| 77 super.visitStaticCallSiteTypeInformation(info); | 77 super.visitStaticCallSiteTypeInformation(info); |
| 78 Element called = info.calledElement; | 78 Element called = info.calledElement; |
| 79 if (compiler.backend.isForeign(called)) { | 79 if (compiler.backend.isForeign(called)) { |
| 80 String name = called.name; | 80 String name = called.name; |
| 81 if (name == BackendHelpers.JS || name == 'DART_CLOSURE_TO_JS') { | 81 if (name == JavaScriptBackend.JS || name == 'DART_CLOSURE_TO_JS') { |
| 82 bailout('Used in JS ${info.call}'); | 82 bailout('Used in JS ${info.call}'); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 if (called.isGetter && | 85 if (called.isGetter && |
| 86 info.selector != null && | 86 info.selector != null && |
| 87 info.selector.isCall && | 87 info.selector.isCall && |
| 88 inferrer.types.getInferredTypeOf(called) == currentUser) { | 88 inferrer.types.getInferredTypeOf(called) == currentUser) { |
| 89 // This node can be a closure call as well. For example, `foo()` | 89 // This node can be a closure call as well. For example, `foo()` |
| 90 // where `foo` is a getter. | 90 // where `foo` is a getter. |
| 91 _registerCallForLaterAnalysis(info); | 91 _registerCallForLaterAnalysis(info); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 @override | 134 @override |
| 135 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { | 135 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { |
| 136 super.visitStaticCallSiteTypeInformation(info); | 136 super.visitStaticCallSiteTypeInformation(info); |
| 137 if (info.calledElement == tracedElements.first && | 137 if (info.calledElement == tracedElements.first && |
| 138 info.selector != null && | 138 info.selector != null && |
| 139 info.selector.isGetter) { | 139 info.selector.isGetter) { |
| 140 addNewEscapeInformation(info); | 140 addNewEscapeInformation(info); |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 } | 143 } |
| OLD | NEW |