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

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

Issue 2994353002: Fix the locals lookup of variables and partial implementation of boxing of variables.
Patch Set: Created 3 years, 4 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/locals_handler.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 '../js_model/closure.dart' show JRecord;
23 import '../elements/elements.dart' show Element; 24 import '../elements/elements.dart' show Element;
24 import '../elements/entities.dart'; 25 import '../elements/entities.dart';
25 import '../util/util.dart' show Hashing; 26 import '../util/util.dart' show Hashing;
26 import '../world.dart' show World; 27 import '../world.dart' show World;
27 import 'call_structure.dart' show CallStructure; 28 import 'call_structure.dart' show CallStructure;
28 import 'selector.dart' show Selector; 29 import 'selector.dart' show Selector;
29 import 'world_builder.dart' show ReceiverConstraint; 30 import 'world_builder.dart' show ReceiverConstraint;
30 31
31 enum DynamicUseKind { 32 enum DynamicUseKind {
32 INVOKE, 33 INVOKE,
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 assert( 352 assert(
352 element.isInstanceMember, 353 element.isInstanceMember,
353 failedAt( 354 failedAt(
354 element, "Field init element $element must be an instance field.")); 355 element, "Field init element $element must be an instance field."));
355 return new StaticUse.internal(element, StaticUseKind.GENERAL); 356 return new StaticUse.internal(element, StaticUseKind.GENERAL);
356 } 357 }
357 358
358 /// Read access of an instance field or boxed field [element]. 359 /// Read access of an instance field or boxed field [element].
359 factory StaticUse.fieldGet(FieldEntity element) { 360 factory StaticUse.fieldGet(FieldEntity element) {
360 assert( 361 assert(
361 element.isInstanceMember || element is BoxFieldElement, 362 element.isInstanceMember ||
363 element is BoxFieldElement ||
364 element is JRecord,
362 failedAt(element, 365 failedAt(element,
363 "Field init element $element must be an instance or boxed field.")); 366 "Field init element $element must be an instance or boxed field."));
364 return new StaticUse.internal(element, StaticUseKind.FIELD_GET); 367 return new StaticUse.internal(element, StaticUseKind.FIELD_GET);
365 } 368 }
366 369
367 /// Write access of an instance field or boxed field [element]. 370 /// Write access of an instance field or boxed field [element].
368 factory StaticUse.fieldSet(FieldEntity element) { 371 factory StaticUse.fieldSet(FieldEntity element) {
369 assert( 372 assert(
370 element.isInstanceMember || element is BoxFieldElement, 373 element.isInstanceMember ||
374 element is BoxFieldElement ||
375 element is JRecord,
371 failedAt(element, 376 failedAt(element,
372 "Field init element $element must be an instance or boxed field.")); 377 "Field init element $element must be an instance or boxed field."));
373 return new StaticUse.internal(element, StaticUseKind.FIELD_SET); 378 return new StaticUse.internal(element, StaticUseKind.FIELD_SET);
374 } 379 }
375 380
376 /// Read of a local function [element]. 381 /// Read of a local function [element].
377 factory StaticUse.closure(Local element) { 382 factory StaticUse.closure(Local element) {
378 return new StaticUse.internal(element, StaticUseKind.CLOSURE); 383 return new StaticUse.internal(element, StaticUseKind.CLOSURE);
379 } 384 }
380 385
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 : this._(value, ConstantUseKind.DIRECT); 531 : this._(value, ConstantUseKind.DIRECT);
527 532
528 bool operator ==(other) { 533 bool operator ==(other) {
529 if (identical(this, other)) return true; 534 if (identical(this, other)) return true;
530 if (other is! ConstantUse) return false; 535 if (other is! ConstantUse) return false;
531 return value == other.value; 536 return value == other.value;
532 } 537 }
533 538
534 String toString() => 'ConstantUse(${value.toStructuredText()},$kind)'; 539 String toString() => 'ConstantUse(${value.toStructuredText()},$kind)';
535 } 540 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/locals_handler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698