| Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
|
| index f0f844a85e402be7e059f65aa7a0ee8f865a79cd..b630968073d3ec1590576ecd222e7b61149b7537 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
|
| @@ -2582,14 +2582,10 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| // TODO(karlklose): change construction of the representations to be GVN'able
|
| // (dartbug.com/7182).
|
| List<HInstruction> buildTypeArgumentRepresentations(DartType type) {
|
| - HInstruction createForeignArray(String code, inputs) {
|
| - return createForeign(code, HType.READABLE_ARRAY, inputs);
|
| - }
|
| -
|
| // Compute the representation of the type arguments, including access
|
| // to the runtime type information for type variables as instructions.
|
| HInstruction representations;
|
| - if (type.element.isTypeVariable()) {
|
| + if (type.kind == TypeKind.TYPE_VARIABLE) {
|
| return <HInstruction>[addTypeVariableReference(type)];
|
| } else {
|
| assert(type.element.isClass());
|
| @@ -2601,7 +2597,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| HInstruction runtimeType = addTypeVariableReference(variable);
|
| inputs.add(runtimeType);
|
| });
|
| - HInstruction representation = createForeignArray(template, inputs);
|
| + HInstruction representation =
|
| + createForeign(template, HType.READABLE_ARRAY, inputs);
|
| add(representation);
|
| arguments.add(representation);
|
| }
|
| @@ -2633,6 +2630,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| isNot = true;
|
| }
|
| DartType type = elements.getType(typeAnnotation);
|
| + compiler.enqueuer.codegen.registerIsCheck(type);
|
| if (type.isMalformed) {
|
| String reasons = Types.fetchReasonsFromMalformedType(type);
|
| if (compiler.enableTypeAssertions) {
|
| @@ -2642,16 +2640,23 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| }
|
| return;
|
| }
|
| - if (type.element.isTypeVariable()) {
|
| - // TODO(karlklose): remove this check when the backend can deal with
|
| - // checks of the form [:o is T:] where [:T:] is a type variable.
|
| - stack.add(graph.addConstantBool(true, constantSystem));
|
| - return;
|
| - }
|
|
|
| HInstruction instruction;
|
| - if (type.element.isTypeVariable() ||
|
| - RuntimeTypeInformation.hasTypeArguments(type)) {
|
| + if (type.kind == TypeKind.TYPE_VARIABLE) {
|
| + List<HInstruction> representations =
|
| + buildTypeArgumentRepresentations(type);
|
| + assert(representations.length == 1);
|
| + HInstruction runtimeType = addTypeVariableReference(type);
|
| + Element helper =
|
| + compiler.findHelper(const SourceString('objectIsSubtype'));
|
| + HInstruction helperCall = new HStatic(helper);
|
| + add(helperCall);
|
| + List<HInstruction> inputs = <HInstruction>[helperCall, expression,
|
| + runtimeType];
|
| + instruction = new HInvokeStatic(inputs, HType.BOOLEAN);
|
| + add(instruction);
|
| +
|
| + } else if (RuntimeTypeInformation.hasTypeArguments(type)) {
|
|
|
| void argumentsCheck() {
|
| HInstruction typeInfo = getRuntimeTypeInfo(expression);
|
| @@ -2680,7 +2685,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| void classCheck() { push(new HIs(type, <HInstruction>[expression])); }
|
|
|
| SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this, node);
|
| - branchBuilder.handleLogicalAndOr(classCheck, argumentsCheck, isAnd: true);
|
| + branchBuilder.handleLogicalAndOr(classCheck, argumentsCheck,
|
| + isAnd: true);
|
| instruction = pop();
|
| } else {
|
| instruction = new HIs(type, <HInstruction>[expression]);
|
|
|