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

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

Issue 2854013002: Make JavaScriptBackend.processAnnotations element-model agnostic (Closed)
Patch Set: Fix and check declaration invariant. Created 3 years, 7 months 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart'; 8 import '../common/names.dart';
9 import '../compiler.dart'; 9 import '../compiler.dart';
10 import '../constants/expressions.dart'; 10 import '../constants/expressions.dart';
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 final Map<Element, GlobalTypeInferenceElementData> inTreeData = 78 final Map<Element, GlobalTypeInferenceElementData> inTreeData =
79 new Map<Element, GlobalTypeInferenceElementData>(); 79 new Map<Element, GlobalTypeInferenceElementData>();
80 80
81 InferrerEngine(this.compiler, ClosedWorld closedWorld, 81 InferrerEngine(this.compiler, ClosedWorld closedWorld,
82 this.closedWorldRefiner, this.mainElement) 82 this.closedWorldRefiner, this.mainElement)
83 : this.types = new TypeSystem(closedWorld), 83 : this.types = new TypeSystem(closedWorld),
84 this.closedWorld = closedWorld; 84 this.closedWorld = closedWorld;
85 85
86 CommonElements get commonElements => closedWorld.commonElements; 86 CommonElements get commonElements => closedWorld.commonElements;
87 87
88 /// Returns `true` if [element] has an `@AssumeDynamic()` annotation.
89 bool assumeDynamic(Element element) {
90 return element is MemberElement && optimizerHints.assumeDynamic(element);
91 }
92
93 /// Returns `true` if [element] has an `@TrustTypeAnnotations()` annotation.
94 bool trustTypeAnnotations(Element element) {
95 return element is MemberElement &&
96 optimizerHints.trustTypeAnnotations(element);
97 }
98
88 /** 99 /**
89 * Applies [f] to all elements in the universe that match 100 * Applies [f] to all elements in the universe that match
90 * [selector] and [mask]. If [f] returns false, aborts the iteration. 101 * [selector] and [mask]. If [f] returns false, aborts the iteration.
91 */ 102 */
92 void forEachElementMatching( 103 void forEachElementMatching(
93 Selector selector, TypeMask mask, bool f(Element element)) { 104 Selector selector, TypeMask mask, bool f(Element element)) {
94 Iterable<MemberEntity> elements = 105 Iterable<MemberEntity> elements =
95 closedWorld.allFunctions.filter(selector, mask); 106 closedWorld.allFunctions.filter(selector, mask);
96 for (MemberElement e in elements) { 107 for (MemberElement e in elements) {
97 if (!f(e.implementation)) return; 108 if (!f(e.implementation)) return;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 230 }
220 231
221 void recordExposesThis(Element element, bool exposesThis) { 232 void recordExposesThis(Element element, bool exposesThis) {
222 element = element.implementation; 233 element = element.implementation;
223 if (exposesThis) { 234 if (exposesThis) {
224 generativeConstructorsExposingThis.add(element); 235 generativeConstructorsExposingThis.add(element);
225 } 236 }
226 } 237 }
227 238
228 JavaScriptBackend get backend => compiler.backend; 239 JavaScriptBackend get backend => compiler.backend;
229 OptimizerHintsForTests get annotations => backend.annotations; 240 OptimizerHintsForTests get optimizerHints => backend.optimizerHints;
230 DiagnosticReporter get reporter => compiler.reporter; 241 DiagnosticReporter get reporter => compiler.reporter;
231 CommonMasks get commonMasks => closedWorld.commonMasks; 242 CommonMasks get commonMasks => closedWorld.commonMasks;
232 243
233 /** 244 /**
234 * A set of selector names that [List] implements, that we know return 245 * A set of selector names that [List] implements, that we know return
235 * their element type. 246 * their element type.
236 */ 247 */
237 final Set<Selector> returnsListElementTypeSet = 248 final Set<Selector> returnsListElementTypeSet =
238 new Set<Selector>.from(<Selector>[ 249 new Set<Selector>.from(<Selector>[
239 new Selector.getter(const PublicName('first')), 250 new Selector.getter(const PublicName('first')),
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 /** 1086 /**
1076 * Records that the captured variable [local] is read. 1087 * Records that the captured variable [local] is read.
1077 */ 1088 */
1078 void recordCapturedLocalRead(Local local) {} 1089 void recordCapturedLocalRead(Local local) {}
1079 1090
1080 /** 1091 /**
1081 * Records that the variable [local] is being updated. 1092 * Records that the variable [local] is being updated.
1082 */ 1093 */
1083 void recordLocalUpdate(Local local, TypeInformation type) {} 1094 void recordLocalUpdate(Local local, TypeInformation type) {}
1084 } 1095 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common_elements.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698