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

Unified Diff: pkg/compiler/lib/src/world.dart

Issue 1182913003: Split TypedSelector into Selector and TypeMask. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/use_unused_api.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/world.dart
diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart
index 99b449334a0f99394ed7e745734701baca2aa017..21dc96e25de66de1104ce55edcad97390ff0ca2f 100644
--- a/pkg/compiler/lib/src/world.dart
+++ b/pkg/compiler/lib/src/world.dart
@@ -111,8 +111,10 @@ class World implements ClassWorld {
ClassElement get doubleClass => compiler.doubleClass;
ClassElement get stringClass => compiler.stringClass;
- Map<Selector, Map<ti.TypeMask, TypedSelector>> canonicalizedValues =
- new Map<Selector, Map<ti.TypeMask, TypedSelector>>();
+ /// Cache of [ti.FlatTypeMask]s grouped by the 8 possible values of the
+ /// [ti.FlatTypeMask.flags] property.
+ List<Map<ClassElement, ti.TypeMask>> canonicalizedTypeMasks =
+ new List<Map<ClassElement, ti.TypeMask>>.filled(8, null);
bool checkInvariants(ClassElement cls, {bool mustBeInstantiated: true}) {
return
@@ -405,8 +407,8 @@ class World implements ClassWorld {
users.add(mixinApplication);
}
- bool hasAnyUserDefinedGetter(Selector selector) {
- return allFunctions.filter(selector).any((each) => each.isGetter);
+ bool hasAnyUserDefinedGetter(Selector selector, ti.TypeMask mask) {
+ return allFunctions.filter(selector, mask).any((each) => each.isGetter);
}
void registerUsedElement(Element element) {
@@ -415,16 +417,26 @@ class World implements ClassWorld {
}
}
- VariableElement locateSingleField(Selector selector) {
- Element result = locateSingleElement(selector);
+ VariableElement locateSingleField(Selector selector, ti.TypeMask mask) {
+ Element result = locateSingleElement(selector, mask);
return (result != null && result.isField) ? result : null;
}
- Element locateSingleElement(Selector selector) {
- ti.TypeMask mask = selector.mask == null
+ Element locateSingleElement(Selector selector, ti.TypeMask mask) {
+ mask = mask == null
? compiler.typesTask.dynamicType
- : selector.mask;
- return mask.locateSingleElement(selector, compiler);
+ : mask;
+ return mask.locateSingleElement(selector, mask, compiler);
+ }
+
+ ti.TypeMask extendMaskIfReachesAll(Selector selector, ti.TypeMask mask) {
+ bool canReachAll = true;
+ if (mask != null) {
+ canReachAll =
+ compiler.enabledInvokeOn &&
+ mask.needsNoSuchMethodHandling(selector, this);
+ }
+ return canReachAll ? compiler.typesTask.dynamicType : mask;
}
void addFunctionCalledInLoop(Element element) {
@@ -475,11 +487,11 @@ class World implements ClassWorld {
sideEffectsFreeElements.add(element);
}
- SideEffects getSideEffectsOfSelector(Selector selector) {
+ SideEffects getSideEffectsOfSelector(Selector selector, ti.TypeMask mask) {
// We're not tracking side effects of closures.
if (selector.isClosureCall) return new SideEffects();
SideEffects sideEffects = new SideEffects.empty();
- for (Element e in allFunctions.filter(selector)) {
+ for (Element e in allFunctions.filter(selector, mask)) {
if (e.isField) {
if (selector.isGetter) {
if (!fieldNeverChanges(e)) {
« no previous file with comments | « pkg/compiler/lib/src/use_unused_api.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698