Chromium Code Reviews| Index: pkg/compiler/lib/src/js_backend/backend.dart |
| diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart |
| index 4d4490cf6b4946a24eb7fb6fbc6c13d5cc1229e2..cc38a4c05eac6c050b609e157445b92f67451cd1 100644 |
| --- a/pkg/compiler/lib/src/js_backend/backend.dart |
| +++ b/pkg/compiler/lib/src/js_backend/backend.dart |
| @@ -1439,18 +1439,6 @@ class JavaScriptBackend extends Backend { |
| } |
| } |
| - void registerRequiredType(DartType type) { |
| - // If [argument] has type variables or is a type variable, this method |
| - // registers a RTI dependency between the class where the type variable is |
| - // defined (that is the enclosing class of the current element being |
| - // resolved) and the class of [type]. If the class of [type] requires RTI, |
| - // then the class of the type variable does too. |
| - ClassElement contextClass = Types.getClassContext(type); |
| - if (contextClass != null) { |
| - rti.registerRtiDependency(type.element, contextClass); |
| - } |
| - } |
| - |
| bool classNeedsRti(ClassElement cls) { |
| return rti.classesNeedingRti.contains(cls.declaration) || |
| compiler.enabledRuntimeType; |
| @@ -2909,6 +2897,11 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks { |
| break; |
| } |
| } |
| + |
| + for (InterfaceType type in worldImpact.instantiatedTypes) { |
| + registerRequiredType(type); |
| + } |
| + |
| for (DartType type in worldImpact.isChecks) { |
| onIsCheck(type, transformed); |
| } |
| @@ -2926,8 +2919,8 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks { |
| } |
| } |
| - for (DartType requiredType in worldImpact.requiredTypes) { |
| - backend.registerRequiredType(requiredType); |
| + for (DartType type in worldImpact.onCatchTypes) { |
| + onIsCheck(type, transformed); |
| } |
| for (MapLiteralUse mapLiteralUse in worldImpact.mapLiterals) { |
| @@ -2938,12 +2931,14 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks { |
| } else { |
| transformed.registerInstantiatedType(mapLiteralUse.type); |
| } |
| + registerRequiredType(mapLiteralUse.type); |
| } |
| for (ListLiteralUse listLiteralUse in worldImpact.listLiterals) { |
| // TODO(johnniwinther): Use the [isConstant] and [isEmpty] property when |
| // factory constructors are registered directly. |
| transformed.registerInstantiatedType(listLiteralUse.type); |
| + registerRequiredType(listLiteralUse.type); |
| } |
| if (worldImpact.typeLiterals.isNotEmpty) { |
| @@ -2962,17 +2957,24 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks { |
| } |
| } |
| - for (String constSymbolName in worldImpact.constSymbolNames) { |
| - backend.registerConstSymbol(constSymbolName); |
| + if (worldImpact.constSymbolNames.isNotEmpty) { |
| + registerBackendImpact(transformed, impacts.constSymbol); |
| + for (String constSymbolName in worldImpact.constSymbolNames) { |
| + backend.registerConstSymbol(constSymbolName); |
| + } |
| } |
| - for (LocalFunctionElement closure in worldImpact.closures) { |
| - if (closure.computeType(backend.resolution).containsTypeVariables) { |
| - backend.compiler.enqueuer.resolution.universe |
| - .closuresWithFreeTypeVariables.add(closure); |
| - registerBackendImpact(transformed, impacts.computeSignature); |
| + if (worldImpact.closures.isNotEmpty) { |
| + registerBackendImpact(transformed, impacts.closure); |
| + for (LocalFunctionElement closure in worldImpact.closures) { |
| + if (closure.computeType(backend.resolution).containsTypeVariables) { |
| + backend.compiler.enqueuer.resolution.universe |
| + .closuresWithFreeTypeVariables.add(closure); |
| + registerBackendImpact(transformed, impacts.computeSignature); |
| + } |
| } |
| } |
| + |
| return transformed; |
| } |
| @@ -2997,8 +2999,21 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks { |
| } |
| } |
| + void registerRequiredType(DartType type) { |
|
sigurdm
2015/10/22 09:18:03
Could use comment. What is a "required" type?
Johnni Winther
2015/10/22 10:31:55
Required for RTI. Added a doc comment.
|
| + // If [argument] has type variables or is a type variable, this method |
| + // registers a RTI dependency between the class where the type variable is |
| + // defined (that is the enclosing class of the current element being |
| + // resolved) and the class of [type]. If the class of [type] requires RTI, |
| + // then the class of the type variable does too. |
| + ClassElement contextClass = Types.getClassContext(type); |
| + if (contextClass != null) { |
| + backend.rti.registerRtiDependency(type.element, contextClass); |
| + } |
| + } |
| + |
| // TODO(johnniwinther): Maybe split this into [onAssertType] and [onTestType]. |
| void onIsCheck(DartType type, TransformedWorldImpact transformed) { |
| + registerRequiredType(type); |
| type.computeUnaliased(backend.resolution); |
| type = type.unaliased; |
| registerBackendImpact(transformed, impacts.typeCheck); |