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

Side by Side Diff: pkg/compiler/lib/src/universe/use.dart

Issue 2366363002: Move remaining functionality from ClassWorld to ClosedWorld (Closed)
Patch Set: Created 4 years, 2 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /// This library defines individual world impacts. 5 /// This library defines individual world impacts.
6 /// 6 ///
7 /// We call these building blocks `uses`. Each `use` is a single impact of the 7 /// We call these building blocks `uses`. Each `use` is a single impact of the
8 /// world. Some example uses are: 8 /// world. Some example uses are:
9 /// 9 ///
10 /// * an invocation of a top level function 10 /// * an invocation of a top level function
11 /// * a call to the `foo()` method on an unknown class. 11 /// * a call to the `foo()` method on an unknown class.
12 /// * an instantiation of class T 12 /// * an instantiation of class T
13 /// 13 ///
14 /// The different compiler stages combine these uses into `WorldImpact` objects, 14 /// The different compiler stages combine these uses into `WorldImpact` objects,
15 /// which are later used to construct a closed-world understanding of the 15 /// which are later used to construct a closed-world understanding of the
16 /// program. 16 /// program.
17 library dart2js.universe.use; 17 library dart2js.universe.use;
18 18
19 import '../closure.dart' show BoxFieldElement; 19 import '../closure.dart' show BoxFieldElement;
20 import '../common.dart'; 20 import '../common.dart';
21 import '../dart_types.dart'; 21 import '../dart_types.dart';
22 import '../elements/elements.dart'; 22 import '../elements/elements.dart';
23 import '../util/util.dart' show Hashing; 23 import '../util/util.dart' show Hashing;
24 import '../world.dart' show ClassWorld; 24 import '../world.dart' show World;
25 import 'call_structure.dart' show CallStructure; 25 import 'call_structure.dart' show CallStructure;
26 import 'selector.dart' show Selector; 26 import 'selector.dart' show Selector;
27 import 'universe.dart' show ReceiverConstraint; 27 import 'universe.dart' show ReceiverConstraint;
28 28
29 enum DynamicUseKind { INVOKE, GET, SET, } 29 enum DynamicUseKind { INVOKE, GET, SET, }
30 30
31 /// The use of a dynamic property. [selector] defined the name and kind of the 31 /// The use of a dynamic property. [selector] defined the name and kind of the
32 /// property and [mask] defines the known constraint for the object on which 32 /// property and [mask] defines the known constraint for the object on which
33 /// the property is accessed. 33 /// the property is accessed.
34 class DynamicUse { 34 class DynamicUse {
35 final Selector selector; 35 final Selector selector;
36 final ReceiverConstraint mask; 36 final ReceiverConstraint mask;
37 37
38 DynamicUse(this.selector, this.mask); 38 DynamicUse(this.selector, this.mask);
39 39
40 bool appliesUnnamed(Element element, ClassWorld world) { 40 bool appliesUnnamed(Element element, World world) {
41 return selector.appliesUnnamed(element, world.backend) && 41 return selector.appliesUnnamed(element) &&
42 (mask == null || mask.canHit(element, selector, world)); 42 (mask == null || mask.canHit(element, selector, world));
43 } 43 }
44 44
45 DynamicUseKind get kind { 45 DynamicUseKind get kind {
46 if (selector.isGetter) { 46 if (selector.isGetter) {
47 return DynamicUseKind.GET; 47 return DynamicUseKind.GET;
48 } else if (selector.isSetter) { 48 } else if (selector.isSetter) {
49 return DynamicUseKind.SET; 49 return DynamicUseKind.SET;
50 } else { 50 } else {
51 return DynamicUseKind.INVOKE; 51 return DynamicUseKind.INVOKE;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 bool operator ==(other) { 312 bool operator ==(other) {
313 if (identical(this, other)) return true; 313 if (identical(this, other)) return true;
314 if (other is! TypeUse) return false; 314 if (other is! TypeUse) return false;
315 return type == other.type && kind == other.kind; 315 return type == other.type && kind == other.kind;
316 } 316 }
317 317
318 String toString() => 'TypeUse($type,$kind)'; 318 String toString() => 'TypeUse($type,$kind)';
319 } 319 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698