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

Unified Diff: lib/compiler/implementation/compiler.dart

Issue 10700122: Generalize the use of type information for setters and initializers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/compiler.dart
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index 35072a9b10a2f07f9b1c70b43141f3c2fe689019..dcd3af2a3954daa83868a89ca7bc7d26758a217f 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -121,27 +121,14 @@ class JavaScriptBackend extends Backend {
}
}
- bool couldHaveFieldSingleTypeInitializers(Element field,
- HType requestedType) {
+ HType typeFromInitializersSoFar(Element field) {
assert(field.isField());
assert(field.enclosingElement.isClass());
- // If there is no information on the initializer it might still be
- // initialized to integers only.
- if (!fieldInitializers.containsKey(field.enclosingElement)) return true;
- Map<Element, HType> fields = fieldInitializers[field.enclosingElement];
- HType propagatedType = fields[field];
- if (propagatedType == null) return true;
- return propagatedType == requestedType;
- }
-
- bool hasFieldSingleTypeInitializers(Element field, HType requestedType) {
- assert(field.isField());
- assert(field.enclosingElement.isClass());
- if (!fieldInitializers.containsKey(field.enclosingElement)) return false;
+ if (!fieldInitializers.containsKey(field.enclosingElement)) {
+ return HType.UNKNOWN;
+ }
Map<Element, HType> fields = fieldInitializers[field.enclosingElement];
- HType propagatedType = fields[field];
- if (propagatedType == null) return false;
- return propagatedType == requestedType;
+ return fields[field];
}
void updateFieldConstructorSetters(Element field, HType type) {
@@ -203,8 +190,8 @@ class JavaScriptBackend extends Backend {
}
}
- // Returns whether nothing but setters setting the field to an integer have
- // been seen during compilation so far.
+ // Returns the type that field setters are setting the field to based on what
+ // have been seen during compilation so far.
HType fieldSettersTypeSoFar(Element field) {
assert(field.isField());
assert(field.enclosingElement.isClass());
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/optimize.dart » ('j') | lib/compiler/implementation/ssa/optimize.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698