Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: pkg/compiler/lib/src/inferrer/closure_tracer.dart

Issue 2467493003: Compute NativeBehavior for native methods and fields. (Closed)
Patch Set: Updated cf. comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/list_tracer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 '../types/types.dart' show TypeMask; 10 import '../types/types.dart' show TypeMask;
10 import '../universe/selector.dart' show Selector; 11 import '../universe/selector.dart' show Selector;
11 import 'debug.dart' as debug; 12 import 'debug.dart' as debug;
12 import 'node_tracer.dart'; 13 import 'node_tracer.dart';
13 import 'type_graph_nodes.dart'; 14 import 'type_graph_nodes.dart';
14 15
15 class ClosureTracerVisitor extends TracerVisitor<ApplyableTypeInformation> { 16 class ClosureTracerVisitor extends TracerVisitor<ApplyableTypeInformation> {
16 final Iterable<FunctionElement> tracedElements; 17 final Iterable<FunctionElement> tracedElements;
17 final List<CallSiteTypeInformation> _callsToAnalyze = 18 final List<CallSiteTypeInformation> _callsToAnalyze =
18 new List<CallSiteTypeInformation>(); 19 new List<CallSiteTypeInformation>();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 bailout('Passed to a closure'); 65 bailout('Passed to a closure');
65 } 66 }
66 } 67 }
67 68
68 @override 69 @override
69 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { 70 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
70 super.visitStaticCallSiteTypeInformation(info); 71 super.visitStaticCallSiteTypeInformation(info);
71 Element called = info.calledElement; 72 Element called = info.calledElement;
72 if (compiler.backend.isForeign(called)) { 73 if (compiler.backend.isForeign(called)) {
73 String name = called.name; 74 String name = called.name;
74 if (name == 'JS' || name == 'DART_CLOSURE_TO_JS') { 75 if (name == BackendHelpers.JS || name == 'DART_CLOSURE_TO_JS') {
75 bailout('Used in JS ${info.call}'); 76 bailout('Used in JS ${info.call}');
76 } 77 }
77 } 78 }
78 if (called.isGetter && 79 if (called.isGetter &&
79 info.selector != null && 80 info.selector != null &&
80 info.selector.isCall && 81 info.selector.isCall &&
81 inferrer.types.getInferredTypeOf(called) == currentUser) { 82 inferrer.types.getInferredTypeOf(called) == currentUser) {
82 // This node can be a closure call as well. For example, `foo()` 83 // This node can be a closure call as well. For example, `foo()`
83 // where `foo` is a getter. 84 // where `foo` is a getter.
84 _registerCallForLaterAnalysis(info); 85 _registerCallForLaterAnalysis(info);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 @override 126 @override
126 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) { 127 visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
127 super.visitStaticCallSiteTypeInformation(info); 128 super.visitStaticCallSiteTypeInformation(info);
128 if (info.calledElement == tracedElements.first && 129 if (info.calledElement == tracedElements.first &&
129 info.selector != null && 130 info.selector != null &&
130 info.selector.isGetter) { 131 info.selector.isGetter) {
131 addNewEscapeInformation(info); 132 addNewEscapeInformation(info);
132 } 133 }
133 } 134 }
134 } 135 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/list_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698