Chromium Code Reviews| Index: pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
| diff --git a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
| index 2308e41feb7e67619bf285dc17f1b201a8a5350f..90c048ecabaf4ad9a120233bdced63cec18ace53 100644 |
| --- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
| +++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
| @@ -74,7 +74,7 @@ class TypeInformationSystem extends TypeSystem<TypeInformation> { |
| TypeInformationSystem(Compiler compiler, this.commonMasks) |
| : this.compiler = compiler, |
| - this.classWorld = compiler.world { |
| + this.classWorld = compiler.closedWorld { |
| nonNullEmptyType = getConcreteTypeFor(const TypeMask.nonNullEmpty()); |
| } |
| @@ -253,7 +253,7 @@ class TypeInformationSystem extends TypeSystem<TypeInformation> { |
| TypeInformation receiver, bool isConditional) { |
| if (receiver.type.isExact) return receiver; |
| TypeMask otherType = |
| - compiler.world.allFunctions.receiverType(selector, mask); |
| + compiler.closedWorld.allFunctions.receiverType(selector, mask); |
| // Conditional sends (a?.b) can still narrow the possible types of `a`, |
| // however, we still need to consider that `a` may be null. |
| if (isConditional) { |
| @@ -276,7 +276,10 @@ class TypeInformationSystem extends TypeSystem<TypeInformation> { |
| {bool isNullable: true}) { |
| if (annotation.treatAsDynamic) return type; |
| if (annotation.isVoid) return nullType; |
| - if (annotation.element == classWorld.objectClass && isNullable) return type; |
| + if (annotation.element == classWorld.coreClasses.objectClass && |
| + isNullable) { |
| + return type; |
| + } |
| TypeMask otherType; |
| if (annotation.isTypedef || annotation.isFunctionType) { |
| otherType = functionType.type; |
| @@ -285,7 +288,7 @@ class TypeInformationSystem extends TypeSystem<TypeInformation> { |
| return type; |
| } else { |
| assert(annotation.isInterfaceType); |
| - otherType = annotation.element == classWorld.objectClass |
| + otherType = annotation.element == classWorld.coreClasses.objectClass |
| ? dynamicType.type.nonNullable() |
| : new TypeMask.nonNullSubtype(annotation.element, classWorld); |
| } |
| @@ -701,7 +704,7 @@ class TypeGraphInferrerEngine |
| tracer.run(); |
| if (!tracer.continueAnalyzing) { |
| elements.forEach((FunctionElement e) { |
| - compiler.world.registerMightBePassedToApply(e); |
| + compiler.inferenceWorld.registerMightBePassedToApply(e); |
| if (debug.VERBOSE) print("traced closure $e as ${true} (bail)"); |
| e.functionSignature.forEachParameter((parameter) { |
| types |
| @@ -721,12 +724,13 @@ class TypeGraphInferrerEngine |
| workQueue.add(info); |
| }); |
| if (tracer.tracedType.mightBePassedToFunctionApply) { |
| - compiler.world.registerMightBePassedToApply(e); |
| + compiler.inferenceWorld.registerMightBePassedToApply(e); |
| } |
| ; |
|
Harry Terkelsen
2016/09/20 17:47:41
nit: delete useless semicolon
Johnni Winther
2016/09/21 07:44:53
Done.
|
| if (debug.VERBOSE) { |
| print("traced closure $e as " |
| - "${compiler.world.getMightBePassedToApply(e)}"); |
| + "${compiler.inferenceWorld |
| + .getCurrentlyKnownMightBePassedToApply(e)}"); |
|
Harry Terkelsen
2016/09/20 17:47:41
this is syntactically valid?
Johnni Winther
2016/09/21 07:44:53
Yes. Within ${...} you can put any expression with
|
| } |
| }); |
| } |
| @@ -912,13 +916,14 @@ class TypeGraphInferrerEngine |
| allocatedCalls.forEach((info) { |
| if (!info.inLoop) return; |
| if (info is StaticCallSiteTypeInformation) { |
| - compiler.world.addFunctionCalledInLoop(info.calledElement); |
| - } else if (info.mask != null && !info.mask.containsAll(compiler.world)) { |
| + compiler.inferenceWorld.addFunctionCalledInLoop(info.calledElement); |
| + } else if (info.mask != null && |
| + !info.mask.containsAll(compiler.closedWorld)) { |
| // For instance methods, we only register a selector called in a |
| // loop if it is a typed selector, to avoid marking too many |
| // methods as being called from within a loop. This cuts down |
| // on the code bloat. |
| - info.targets.forEach(compiler.world.addFunctionCalledInLoop); |
| + info.targets.forEach(compiler.inferenceWorld.addFunctionCalledInLoop); |
| } |
| }); |
| } |
| @@ -1185,7 +1190,7 @@ class TypeGraphInferrerEngine |
| arguments, sideEffects, inLoop); |
| } |
| - compiler.world.allFunctions.filter(selector, mask).forEach((callee) { |
| + compiler.closedWorld.allFunctions.filter(selector, mask).forEach((callee) { |
| updateSideEffects(sideEffects, selector, callee); |
| }); |
| @@ -1413,11 +1418,11 @@ class TypeGraphInferrer implements TypesInferrer { |
| TypeMask result = const TypeMask.nonNullEmpty(); |
| Iterable<Element> elements = |
| - compiler.world.allFunctions.filter(selector, mask); |
| + compiler.closedWorld.allFunctions.filter(selector, mask); |
| for (Element element in elements) { |
| TypeMask type = |
| inferrer.typeOfElementWithSelector(element, selector).type; |
| - result = result.union(type, compiler.world); |
| + result = result.union(type, compiler.closedWorld); |
| } |
| return result; |
| } |