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

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

Issue 10694091: Collect the actual types for all field setters. (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 7dd7384e3f11ed35aa005e8fbfc20e8394551259..8ab82c88fadef6636a043f53afb338015736ea92 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -58,7 +58,7 @@ class JavaScriptBackend extends Backend {
CodeEmitterTask emitter;
final Map<Element, Map<Element, HType>> fieldInitializers;
final Map<Element, Map<Element, HType>> fieldConstructorSetters;
- final Map<Element, Map<Element, bool>> fieldIntegerSetters;
+ final Map<Element, Map<Element, HType>> fieldSettersType;
List<CompilerTask> get tasks() {
return <CompilerTask>[builder, optimizer, generator, emitter];
@@ -68,7 +68,7 @@ class JavaScriptBackend extends Backend {
: emitter = new CodeEmitterTask(compiler, generateSourceMap),
fieldInitializers = new Map<Element, Map<Element, HType>>(),
fieldConstructorSetters = new Map<Element, Map<Element, HType>>(),
- fieldIntegerSetters = new Map<Element, Map<Element, bool>>(),
+ fieldSettersType = new Map<Element, Map<Element, HType>>(),
super(compiler) {
builder = new SsaBuilderTask(this);
optimizer = new SsaOptimizerTask(this);
@@ -190,27 +190,29 @@ class JavaScriptBackend extends Backend {
}
}
- void updateFieldIntegerSetters(Element field, bool isInteger) {
+ void updateFieldSetters(Element field, HType type) {
assert(field.isField());
assert(field.enclosingElement.isClass());
Map<Element, bool> fields =
- fieldIntegerSetters.putIfAbsent(
- field.enclosingElement, () => new Map<Element, bool>());
+ fieldSettersType.putIfAbsent(
+ field.enclosingElement, () => new Map<Element, HType>());
if (!fields.containsKey(field)) {
- fields[field] = isInteger;
+ fields[field] = type;
} else {
- fields[field] = fields[field] && isInteger;
+ fields[field] = fields[field].union(type);
}
}
// Returns whether nothing but setters setting the field to an integer have
// been seen during compilation so far.
- bool onlyFieldIntegerSettersSoFar(Element field) {
+ HType fieldSettersTypeSoFar(Element field) {
assert(field.isField());
assert(field.enclosingElement.isClass());
- if (!fieldIntegerSetters.containsKey(field.enclosingElement)) return true;
- Map<Element, bool> fields = fieldIntegerSetters[field.enclosingElement];
- if (!fields.containsKey(field)) return false;
+ if (!fieldSettersType.containsKey(field.enclosingElement)) {
+ return HType.UNKNOWN;
+ }
+ Map<Element, Htype> fields = fieldSettersType[field.enclosingElement];
+ if (!fields.containsKey(field)) return HType.UNKNOWN;
return fields[field];
}
}
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/codegen.dart » ('j') | lib/compiler/implementation/ssa/optimize.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698