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

Side by Side Diff: pkg/fletchc/lib/src/dynamic_call_enqueuer.dart

Issue 1450393002: Roll sdk dependency to 34357cdad108dcba734949bd13bd28c76ea285e0 (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: rebase Created 5 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
OLDNEW
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Fletch 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library fletchc.dynamic_call_enqueuer; 5 library fletchc.dynamic_call_enqueuer;
6 6
7 import 'dart:collection' show 7 import 'dart:collection' show
8 Queue; 8 Queue;
9 9
10 import 'package:compiler/src/universe/universe.dart' show 10 import 'package:compiler/src/universe/selector.dart' show
11 CallStructure, 11 Selector;
12 Selector, 12
13 UniverseSelector; 13 import 'package:compiler/src/universe/use.dart' show
14 DynamicUse;
14 15
15 import 'package:compiler/src/dart_types.dart' show 16 import 'package:compiler/src/dart_types.dart' show
16 DartType, 17 DartType,
17 InterfaceType, 18 InterfaceType,
18 TypeKind; 19 TypeKind;
19 20
20 import 'package:compiler/src/elements/elements.dart' show 21 import 'package:compiler/src/elements/elements.dart' show
21 ClassElement, 22 ClassElement,
22 Element, 23 Element,
23 FunctionElement, 24 FunctionElement,
24 LibraryElement, 25 LibraryElement,
25 MemberElement, 26 MemberElement,
26 Name; 27 Name;
27 28
29 import 'package:compiler/src/common/names.dart' show
30 Identifiers,
31 Names;
32
28 import 'package:compiler/src/util/util.dart' show 33 import 'package:compiler/src/util/util.dart' show
29 Hashing; 34 Hashing;
30 35
31 import 'fletch_compiler_implementation.dart' show 36 import 'fletch_compiler_implementation.dart' show
32 FletchCompilerImplementation; 37 FletchCompilerImplementation;
33 38
34 import 'fletch_enqueuer.dart' show 39 import 'fletch_enqueuer.dart' show
35 shouldReportEnqueuingOfElement; 40 shouldReportEnqueuingOfElement;
36 41
37 import 'fletch_registry.dart' show 42 import 'fletch_registry.dart' show
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 recorder.recordElementUsage(member, selector); 118 recorder.recordElementUsage(member, selector);
114 } 119 }
115 } 120 }
116 121
117 void enqueueClosureIfApplicable( 122 void enqueueClosureIfApplicable(
118 Closurization closurization, 123 Closurization closurization,
119 Selector selector, 124 Selector selector,
120 UsageRecorder recorder) { 125 UsageRecorder recorder) {
121 FunctionElement function = closurization.function; 126 FunctionElement function = closurization.function;
122 if ((selector.isGetter || selector.isCall) && 127 if ((selector.isGetter || selector.isCall) &&
123 selector.memberName == Selector.CALL_NAME && 128 selector.memberName == Names.call &&
124 selector.signatureApplies(function)) { 129 selector.signatureApplies(function)) {
125 recorder.recordClosurizationUsage(closurization, selector); 130 recorder.recordClosurizationUsage(closurization, selector);
126 } 131 }
127 } 132 }
128 133
129 void enqueueApplicableTypeTests( 134 void enqueueApplicableTypeTests(
130 ClassElement cls, 135 ClassElement cls,
131 InterfaceType type, 136 InterfaceType type,
132 UsageRecorder recorder) { 137 UsageRecorder recorder) {
133 if (cls == type.element) { 138 if (cls == type.element) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 189 }
185 while(!pendingTypeTests.isEmpty) { 190 while(!pendingTypeTests.isEmpty) {
186 InterfaceType type = pendingTypeTests.removeFirst(); 191 InterfaceType type = pendingTypeTests.removeFirst();
187 for (ClassElement cls in instantiatedClasses) { 192 for (ClassElement cls in instantiatedClasses) {
188 enqueueApplicableTypeTests(cls, type, recorder); 193 enqueueApplicableTypeTests(cls, type, recorder);
189 } 194 }
190 // TODO(ahe): Also enqueue type tests for closures. 195 // TODO(ahe): Also enqueue type tests for closures.
191 } 196 }
192 } 197 }
193 198
194 void enqueueSelector(UniverseSelector universeSelector) { 199 void enqueueSelector(DynamicUse use) {
195 assert(universeSelector.mask == null); 200 assert(use.mask == null);
196 Selector selector = universeSelector.selector; 201 Selector selector = use.selector;
197 if (enqueuedSelectors.add(selector)) { 202 if (enqueuedSelectors.add(selector)) {
198 pendingSelectors.add(selector); 203 pendingSelectors.add(selector);
199 } 204 }
200 } 205 }
201 206
202 void enqueueClosure(FunctionElement function, ClosureKind kind) { 207 void enqueueClosure(FunctionElement function, ClosureKind kind) {
203 Closurization closurization = new Closurization(function, kind); 208 Closurization closurization = new Closurization(function, kind);
204 if (implicitClosurizations.add(closurization)) { 209 if (implicitClosurizations.add(closurization)) {
205 pendingImplicitClosurizations.add(closurization); 210 pendingImplicitClosurizations.add(closurization);
206 } 211 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 kind = kind, 288 kind = kind,
284 hashCode = Hashing.mixHashCodeBits(function.hashCode, kind.hashCode); 289 hashCode = Hashing.mixHashCodeBits(function.hashCode, kind.hashCode);
285 290
286 bool operator ==(other) { 291 bool operator ==(other) {
287 return other is Closurization && 292 return other is Closurization &&
288 function == other.function && kind == other.kind; 293 function == other.function && kind == other.kind;
289 } 294 }
290 295
291 String toString() => "Closurization($function, $kind)"; 296 String toString() => "Closurization($function, $kind)";
292 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698