Chromium Code Reviews| 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 65dc0abb19088ba49110410f696f8f3f9f97cf9a..000c4c0eba71ca65503de9bac420b116e3544094 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| @@ -2584,14 +2584,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()); |
| @@ -2603,7 +2599,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); |
| } |
| @@ -2635,6 +2632,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| isNot = true; |
| } |
| DartType type = elements.getType(typeAnnotation); |
| + compiler.enqueuer.codegen.registerIsCheck(type); |
|
ngeoffray
2013/02/21 10:26:18
Don't we register the is check in the SSA codegen
karlklose
2013/02/21 14:48:44
It does not for type variable tests, because they
|
| if (type.isMalformed) { |
| String reasons = Types.fetchReasonsFromMalformedType(type); |
| if (compiler.enableTypeAssertions) { |
| @@ -2644,16 +2642,24 @@ 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')); |
|
ngeoffray
2013/02/21 10:26:18
Use the method on the backend to get the helper.
karlklose
2013/02/21 14:48:44
Done.
|
| + HInstruction helperCall = new HStatic(helper); |
| + add(helperCall); |
| + List<HInstruction> inputs = <HInstruction>[helperCall, expression, |
| + runtimeType]; |
| + instruction = new HInvokeStatic(inputs, HType.BOOLEAN); |
| + add(instruction); |
| + ClassElement currentClass = currentElement.getEnclosingClass(); |
|
ngeoffray
2013/02/21 10:26:18
Remove currentClass.
karlklose
2013/02/21 14:48:44
Done.
|
| + |
| + } else if (RuntimeTypeInformation.hasTypeArguments(type)) { |
| void argumentsCheck() { |
| HInstruction typeInfo = getRuntimeTypeInfo(expression); |
| @@ -2682,7 +2688,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]); |