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

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

Issue 10964016: Change the type inference for fields in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final round of changes Created 8 years, 3 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 | « lib/compiler/implementation/js_backend/backend.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index 1cc761beb5c62fc30dfec291a9b145f854ceaab7..7ac1ec40c0792d72e094147ff2303a04e2210404 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -1528,8 +1528,9 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
Selector setter = node.selector;
String name = backend.namer.setterName(setter.library, setter.name);
push(jsPropertyCall(pop(), name, visitArguments(node.inputs)), node);
- world.registerDynamicSetter(
- setter.name, getOptimizedSelectorFor(node, setter));
+ Selector selector = getOptimizedSelectorFor(node, setter);
+ world.registerDynamicSetter(setter.name, selector);
+ backend.addedDynamicSetter(selector, types[node.inputs[1]]);
}
visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
@@ -1638,33 +1639,16 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
visitFieldSet(HFieldSet node) {
- if (work.element.isGenerativeConstructorBody() &&
- node.element.isMember() &&
- node.value.hasGuaranteedType() &&
- node.block.dominates(currentGraph.exit)) {
- backend.updateFieldConstructorSetters(node.element,
- node.value.guaranteedType);
- }
String name = backend.namer.getName(node.element);
DartType type = types[node.receiver].computeType(compiler);
if (type != null) {
+ // Field setters in the generative constructor body are handled in a
+ // step "SsaConstructionFieldTypes" in the ssa optimizer.
if (!work.element.isGenerativeConstructorBody()) {
world.registerFieldSetter(
node.element.name, node.element.getLibrary(), type);
- }
- // Determine the types seen so far for the field. If only number
- // types have been seen and the value of the field set is a
- // simple number computation only depending on that field, we
- // can safely keep the number type for the field.
- HType fieldSettersType = backend.fieldSettersTypeSoFar(node.element);
- HType initializersType =
- backend.typeFromInitializersSoFar(node.element);
- HType fieldType = fieldSettersType.union(initializersType);
- if (HType.NUMBER.union(fieldType) == HType.NUMBER &&
- isSimpleFieldNumberComputation(node.value, node)) {
- backend.updateFieldSetters(node.element, HType.NUMBER);
- } else {
- backend.updateFieldSetters(node.element, types[node.value]);
+ backend.registerFieldSetter(
+ work.element, node.element, types[node.value]);
}
}
use(node.receiver);
@@ -1703,14 +1687,6 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
visitForeignNew(HForeignNew node) {
- int j = 0;
- node.element.forEachInstanceField(
- includeBackendMembers: true,
- includeSuperMembers: true,
- f: (ClassElement enclosingClass, Element member) {
- backend.updateFieldInitializers(member, types[node.inputs[j]]);
- j++;
- });
String jsClassReference = backend.namer.isolateAccess(node.element);
List<HInstruction> inputs = node.inputs;
// We can't use 'visitArguments', since our arguments start at input[0].
« no previous file with comments | « lib/compiler/implementation/js_backend/backend.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698