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

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart

Issue 25000002: Revert r27992: some browser tests fail. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
Index: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart (revision 27994)
+++ sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart (working copy)
@@ -92,17 +92,6 @@
assignments = const <TypeInformation>[];
users = const <TypeInformation>[];
}
-
- bool reachedBy(TypeInformation info, TypeGraphInferrerEngine inferrer) {
- return true;
- }
-
- accept(TypeInformationVisitor visitor);
-
- /// The [Element] where this [TypeInformation] was created. May be
- /// for some [TypeInformation] nodes, where we do not need to store
- /// the information.
- Element get owner => null;
}
/**
@@ -279,12 +268,6 @@
}
String toString() => 'Element $element $type';
-
- accept(TypeInformationVisitor visitor) {
- return visitor.visitElementTypeInformation(this);
- }
-
- Element get owner => element.getOutermostEnclosingMemberOrTopLevel();
}
/**
@@ -318,8 +301,6 @@
/// Return an iterable over the targets of this call.
Iterable<Element> get callees;
-
- Element get owner => caller;
}
class StaticCallSiteTypeInformation extends CallSiteTypeInformation {
@@ -363,14 +344,6 @@
}
Iterable<Element> get callees => [calledElement.implementation];
-
- bool reachedBy(TypeInformation info, TypeGraphInferrerEngine inferrer) {
- return info == inferrer.types.getInferredTypeOf(calledElement);
- }
-
- accept(TypeInformationVisitor visitor) {
- return visitor.visitStaticCallSiteTypeInformation(this);
- }
}
class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
@@ -533,17 +506,7 @@
super.giveUp(inferrer);
}
- bool reachedBy(TypeInformation info, TypeGraphInferrerEngine inferrer) {
- return targets
- .map((element) => inferrer.types.getInferredTypeOf(element))
- .any((other) => other == info);
- }
-
- String toString() => 'Call site $call on ${receiver.type} $type';
-
- accept(TypeInformationVisitor visitor) {
- return visitor.visitDynamicCallSiteTypeInformation(this);
- }
+ String toString() => 'Call site $call ${receiver.type} $type';
}
class ClosureCallSiteTypeInformation extends CallSiteTypeInformation {
@@ -566,14 +529,10 @@
}
Iterable<Element> get callees {
- throw new UnsupportedError("Cannot compute callees of a closure call.");
+ throw new UnsupportedError("Cannot compute callees of a closure.");
}
String toString() => 'Closure call $call on $closure';
-
- accept(TypeInformationVisitor visitor) {
- return visitor.visitClosureCallSiteTypeInformation(this);
- }
}
/**
@@ -610,10 +569,6 @@
}
String toString() => 'Type $type';
-
- accept(TypeInformationVisitor visitor) {
- return visitor.visitConcreteTypeInformation(this);
- }
}
/**
@@ -647,28 +602,23 @@
}
String toString() => 'Narrow ${assignments.first} to $typeAnnotation $type';
-
- accept(TypeInformationVisitor visitor) {
- return visitor.visitNarrowTypeInformation(this);
- }
}
/**
- * A [ContainerTypeInformation] is a [TypeInformation] created
+ * A [ContainerTypeInformation] is a [ConcreteTypeInformation] created
* for each `List` instantiations.
*/
-class ContainerTypeInformation extends TypeInformation {
- final ElementInContainerTypeInformation elementType;
+class ContainerTypeInformation extends ConcreteTypeInformation {
+ final TypeInformation elementType;
- ContainerTypeInformation(containerType, this.elementType) {
- type = containerType;
+ ContainerTypeInformation(containerType, this.elementType)
+ : super(containerType);
+
+ void addUser(TypeInformation user) {
+ elementType.addUser(user);
}
String toString() => 'Container type $type';
-
- accept(TypeInformationVisitor visitor) {
- return visitor.visitContainerTypeInformation(this);
- }
}
/**
@@ -679,27 +629,17 @@
final ContainerTypeMask container;
ElementInContainerTypeInformation(elementType, this.container) {
+ // [elementType] is not null for const lists.
if (elementType != null) addAssignment(elementType);
}
- bool get isInConstContainer {
- LiteralList literal = container.allocationNode.asLiteralList();
- return (literal != null) && literal.isConst();
- }
-
TypeMask refine(TypeGraphInferrerEngine inferrer) {
- if (!isInConstContainer) {
- return inferrer.types.dynamicType.type;
- }
+ if (assignments.isEmpty) return inferrer.types.dynamicType.type;
return container.elementType =
inferrer.types.computeTypeMask(assignments);
}
String toString() => 'Element in container $type';
-
- accept(TypeInformationVisitor visitor) {
- return visitor.visitElementInContainerTypeInformation(this);
- }
}
/**
@@ -718,21 +658,4 @@
}
String toString() => 'Phi $element $type';
-
- accept(TypeInformationVisitor visitor) {
- return visitor.visitPhiElementTypeInformation(this);
- }
}
-
-abstract class TypeInformationVisitor<T> {
- T visitNarrowTypeInformation(NarrowTypeInformation info);
- T visitPhiElementTypeInformation(PhiElementTypeInformation info);
- T visitElementInContainerTypeInformation(
- ElementInContainerTypeInformation info);
- T visitContainerTypeInformation(ContainerTypeInformation info);
- T visitConcreteTypeInformation(ConcreteTypeInformation info);
- T visitClosureCallSiteTypeInformation(ClosureCallSiteTypeInformation info);
- T visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info);
- T visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info);
- T visitElementTypeInformation(ElementTypeInformation info);
-}

Powered by Google App Engine
This is Rietveld 408576698