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

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

Issue 2860893003: Revert "Make JavaScriptBackend.processAnnotations element-model agnostic" (Closed)
Patch Set: 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
99 /** 88 /**
100 * Applies [f] to all elements in the universe that match 89 * Applies [f] to all elements in the universe that match
101 * [selector] and [mask]. If [f] returns false, aborts the iteration. 90 * [selector] and [mask]. If [f] returns false, aborts the iteration.
102 */ 91 */
103 void forEachElementMatching( 92 void forEachElementMatching(
104 Selector selector, TypeMask mask, bool f(Element element)) { 93 Selector selector, TypeMask mask, bool f(Element element)) {
105 Iterable<MemberEntity> elements = 94 Iterable<MemberEntity> elements =
106 closedWorld.allFunctions.filter(selector, mask); 95 closedWorld.allFunctions.filter(selector, mask);
107 for (MemberElement e in elements) { 96 for (MemberElement e in elements) {
108 if (!f(e.implementation)) return; 97 if (!f(e.implementation)) return;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 219 }
231 220
232 void recordExposesThis(Element element, bool exposesThis) { 221 void recordExposesThis(Element element, bool exposesThis) {
233 element = element.implementation; 222 element = element.implementation;
234 if (exposesThis) { 223 if (exposesThis) {
235 generativeConstructorsExposingThis.add(element); 224 generativeConstructorsExposingThis.add(element);
236 } 225 }
237 } 226 }
238 227
239 JavaScriptBackend get backend => compiler.backend; 228 JavaScriptBackend get backend => compiler.backend;
240 OptimizerHintsForTests get optimizerHints => backend.optimizerHints; 229 OptimizerHintsForTests get annotations => backend.annotations;
241 DiagnosticReporter get reporter => compiler.reporter; 230 DiagnosticReporter get reporter => compiler.reporter;
242 CommonMasks get commonMasks => closedWorld.commonMasks; 231 CommonMasks get commonMasks => closedWorld.commonMasks;
243 232
244 /** 233 /**
245 * A set of selector names that [List] implements, that we know return 234 * A set of selector names that [List] implements, that we know return
246 * their element type. 235 * their element type.
247 */ 236 */
248 final Set<Selector> returnsListElementTypeSet = 237 final Set<Selector> returnsListElementTypeSet =
249 new Set<Selector>.from(<Selector>[ 238 new Set<Selector>.from(<Selector>[
250 new Selector.getter(const PublicName('first')), 239 new Selector.getter(const PublicName('first')),
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 /** 1075 /**
1087 * Records that the captured variable [local] is read. 1076 * Records that the captured variable [local] is read.
1088 */ 1077 */
1089 void recordCapturedLocalRead(Local local) {} 1078 void recordCapturedLocalRead(Local local) {}
1090 1079
1091 /** 1080 /**
1092 * Records that the variable [local] is being updated. 1081 * Records that the variable [local] is being updated.
1093 */ 1082 */
1094 void recordLocalUpdate(Local local, TypeInformation type) {} 1083 void recordLocalUpdate(Local local, TypeInformation type) {}
1095 } 1084 }
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