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

Unified Diff: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart

Issue 2314703002: Split World usage into open, inference, and closed world. (Closed)
Patch Set: Updated cf. comments Created 4 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: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
diff --git a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
index 0a6c6283d801fc83013e5c8e65d21d973184b3e2..5910c00ffb4b1c17ea59969e8e2265e185817b16 100644
--- a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
@@ -40,7 +40,7 @@ abstract class InferrerEngine<T, V extends TypeSystem>
InferrerEngine(Compiler compiler, this.types)
: this.compiler = compiler,
- this.classWorld = compiler.world;
+ this.classWorld = compiler.closedWorld;
CoreClasses get coreClasses => compiler.coreClasses;
@@ -174,7 +174,7 @@ abstract class InferrerEngine<T, V extends TypeSystem>
void forEachElementMatching(
Selector selector, TypeMask mask, bool f(Element element)) {
Iterable<Element> elements =
- compiler.world.allFunctions.filter(selector, mask);
+ compiler.closedWorld.allFunctions.filter(selector, mask);
for (Element e in elements) {
if (!f(e.implementation)) return;
}
@@ -210,7 +210,8 @@ abstract class InferrerEngine<T, V extends TypeSystem>
sideEffects.setAllSideEffects();
sideEffects.setDependsOnSomething();
} else {
- sideEffects.add(compiler.world.getSideEffectsOfElement(callee));
+ sideEffects.add(compiler.inferenceWorld
+ .getCurrentlyKnownSideEffects(callee));
}
}
@@ -480,9 +481,9 @@ class SimpleTypeInferrerVisitor<T>
});
}
if (analyzedElement.isGenerativeConstructor && cls.isAbstract) {
- if (compiler.world.isDirectlyInstantiated(cls)) {
+ if (compiler.closedWorld.isDirectlyInstantiated(cls)) {
returnType = types.nonNullExact(cls);
- } else if (compiler.world.isIndirectlyInstantiated(cls)) {
+ } else if (compiler.closedWorld.isIndirectlyInstantiated(cls)) {
returnType = types.nonNullSubclass(cls);
} else {
// TODO(johnniwinther): Avoid analyzing [analyzedElement] in this
@@ -531,7 +532,7 @@ class SimpleTypeInferrerVisitor<T>
}
}
- compiler.world.registerSideEffects(analyzedElement, sideEffects);
+ compiler.inferenceWorld.registerSideEffects(analyzedElement, sideEffects);
assert(breaksFor.isEmpty);
assert(continuesFor.isEmpty);
return returnType;
@@ -645,7 +646,7 @@ class SimpleTypeInferrerVisitor<T>
bool isInClassOrSubclass(Element element) {
ClassElement cls = outermostElement.enclosingClass.declaration;
ClassElement enclosing = element.enclosingClass.declaration;
- return compiler.world.isSubclassOf(enclosing, cls);
+ return compiler.closedWorld.isSubclassOf(enclosing, cls);
}
void checkIfExposesThis(Selector selector, TypeMask mask) {
@@ -1070,7 +1071,7 @@ class SimpleTypeInferrerVisitor<T>
(node.asSendSet() != null) &&
(node.asSendSet().receiver != null) &&
node.asSendSet().receiver.isThis()) {
- Iterable<Element> targets = compiler.world.allFunctions.filter(
+ Iterable<Element> targets = compiler.closedWorld.allFunctions.filter(
setterSelector, types.newTypedSelector(thisType, setterMask));
// We just recognized a field initialization of the form:
// `this.foo = 42`. If there is only one target, we can update
@@ -1297,7 +1298,7 @@ class SimpleTypeInferrerVisitor<T>
} else if (element != null &&
element.isField &&
Elements.isStaticOrTopLevelField(element) &&
- compiler.world.fieldNeverChanges(element)) {
+ compiler.closedWorld.fieldNeverChanges(element)) {
FieldElement fieldElement = element;
ConstantValue value =
compiler.backend.constants.getConstantValue(fieldElement.constant);
@@ -1351,8 +1352,9 @@ class SimpleTypeInferrerVisitor<T>
// In erroneous code the number of arguments in the selector might not
// match the function element.
// TODO(polux): return nonNullEmpty and check it doesn't break anything
- if (!selector.applies(target, compiler.world) ||
- (mask != null && !mask.canHit(target, selector, compiler.world))) {
+ if (!selector.applies(target, compiler.closedWorld) ||
+ (mask != null &&
+ !mask.canHit(target, selector, compiler.closedWorld))) {
return types.dynamicType;
}
« no previous file with comments | « pkg/compiler/lib/src/inferrer/inferrer_visitor.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698