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

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

Issue 2968383002: Add ConstructorBodyEntity (Closed)
Patch Set: Skip non-live constructor bodies Created 3 years, 5 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 '../constants/values.dart'; 21 import '../constants/values.dart';
22 import '../elements/types.dart'; 22 import '../elements/types.dart';
23 import '../elements/elements.dart' show ConstructorBodyElement, Element; 23 import '../elements/elements.dart' show Element;
24 import '../elements/entities.dart'; 24 import '../elements/entities.dart';
25 import '../util/util.dart' show Hashing; 25 import '../util/util.dart' show Hashing;
26 import '../world.dart' show World; 26 import '../world.dart' show World;
27 import 'call_structure.dart' show CallStructure; 27 import 'call_structure.dart' show CallStructure;
28 import 'selector.dart' show Selector; 28 import 'selector.dart' show Selector;
29 import 'world_builder.dart' show ReceiverConstraint; 29 import 'world_builder.dart' show ReceiverConstraint;
30 30
31 enum DynamicUseKind { 31 enum DynamicUseKind {
32 INVOKE, 32 INVOKE,
33 GET, 33 GET,
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 failedAt( 239 failedAt(
240 element, 240 element,
241 "Constructor invoke element $element must be a " 241 "Constructor invoke element $element must be a "
242 "generative constructor.")); 242 "generative constructor."));
243 return new StaticUse.internal(element, StaticUseKind.GENERAL); 243 return new StaticUse.internal(element, StaticUseKind.GENERAL);
244 } 244 }
245 245
246 /// Invocation of a constructor (body) [element] through a this or super 246 /// Invocation of a constructor (body) [element] through a this or super
247 /// constructor call with the given [callStructure]. 247 /// constructor call with the given [callStructure].
248 factory StaticUse.constructorBodyInvoke( 248 factory StaticUse.constructorBodyInvoke(
249 ConstructorBodyElement element, CallStructure callStructure) { 249 ConstructorBodyEntity element, CallStructure callStructure) {
250 // TODO(johnniwinther): Use the [callStructure]. 250 // TODO(johnniwinther): Use the [callStructure].
251 return new StaticUse.internal(element, StaticUseKind.GENERAL); 251 return new StaticUse.internal(element, StaticUseKind.GENERAL);
252 } 252 }
253 253
254 /// Direct invocation of a method [element] with the given [callStructure]. 254 /// Direct invocation of a method [element] with the given [callStructure].
255 factory StaticUse.directInvoke( 255 factory StaticUse.directInvoke(
256 FunctionEntity element, CallStructure callStructure) { 256 FunctionEntity element, CallStructure callStructure) {
257 // TODO(johnniwinther): Use the [callStructure]. 257 // TODO(johnniwinther): Use the [callStructure].
258 assert( 258 assert(
259 element.isInstanceMember, 259 element.isInstanceMember,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 : this._(value, ConstantUseKind.DIRECT); 520 : this._(value, ConstantUseKind.DIRECT);
521 521
522 bool operator ==(other) { 522 bool operator ==(other) {
523 if (identical(this, other)) return true; 523 if (identical(this, other)) return true;
524 if (other is! ConstantUse) return false; 524 if (other is! ConstantUse) return false;
525 return value == other.value; 525 return value == other.value;
526 } 526 }
527 527
528 String toString() => 'ConstantUse(${value.toStructuredText()},$kind)'; 528 String toString() => 'ConstantUse(${value.toStructuredText()},$kind)';
529 } 529 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/type_builder.dart ('k') | tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698