OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of ssa; | 5 part of ssa; |
6 | 6 |
7 /** | 7 /** |
8 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
9 * methods. We need to override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
(...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2834 HInstruction buildIsNode(Node node, DartType type, HInstruction expression) { | 2834 HInstruction buildIsNode(Node node, DartType type, HInstruction expression) { |
2835 if (type.kind == TypeKind.TYPE_VARIABLE) { | 2835 if (type.kind == TypeKind.TYPE_VARIABLE) { |
2836 HInstruction runtimeType = addTypeVariableReference(type); | 2836 HInstruction runtimeType = addTypeVariableReference(type); |
2837 Element helper = backend.getCheckSubtypeOfRuntimeType(); | 2837 Element helper = backend.getCheckSubtypeOfRuntimeType(); |
2838 List<HInstruction> inputs = <HInstruction>[expression, runtimeType]; | 2838 List<HInstruction> inputs = <HInstruction>[expression, runtimeType]; |
2839 pushInvokeStatic(null, helper, inputs, HType.BOOLEAN); | 2839 pushInvokeStatic(null, helper, inputs, HType.BOOLEAN); |
2840 HInstruction call = pop(); | 2840 HInstruction call = pop(); |
2841 return new HIs(type, <HInstruction>[expression, call], | 2841 return new HIs(type, <HInstruction>[expression, call], |
2842 HIs.VARIABLE_CHECK); | 2842 HIs.VARIABLE_CHECK); |
2843 } else if (RuntimeTypes.hasTypeArguments(type)) { | 2843 } else if (RuntimeTypes.hasTypeArguments(type)) { |
2844 Element element = type.element; | 2844 ClassElement element = type.element; |
2845 Element helper = backend.getCheckSubtype(); | 2845 Element helper = backend.getCheckSubtype(); |
2846 HInstruction representations = | 2846 HInstruction representations = |
2847 buildTypeArgumentRepresentations(type); | 2847 buildTypeArgumentRepresentations(type); |
2848 add(representations); | 2848 add(representations); |
2849 String operator = | 2849 String operator = |
2850 backend.namer.operatorIs(backend.getImplementationClass(element)); | 2850 backend.namer.operatorIs(backend.getImplementationClass(element)); |
2851 HInstruction isFieldName = addConstantString(node, operator); | 2851 HInstruction isFieldName = addConstantString(node, operator); |
2852 // TODO(karlklose): use [:null:] for [asField] if [element] does not | 2852 HInstruction asFieldName = compiler.world.hasAnySubtype(element) |
2853 // have a subclass. | 2853 ? addConstantString(node, backend.namer.substitutionName(element)) |
2854 HInstruction asFieldName = | 2854 : graph.addConstantNull(constantSystem); |
2855 addConstantString(node, backend.namer.substitutionName(element)); | |
2856 List<HInstruction> inputs = <HInstruction>[expression, | 2855 List<HInstruction> inputs = <HInstruction>[expression, |
2857 isFieldName, | 2856 isFieldName, |
2858 representations, | 2857 representations, |
2859 asFieldName]; | 2858 asFieldName]; |
2860 pushInvokeStatic(node, helper, inputs, HType.BOOLEAN); | 2859 pushInvokeStatic(node, helper, inputs, HType.BOOLEAN); |
2861 HInstruction call = pop(); | 2860 HInstruction call = pop(); |
2862 return | 2861 return |
2863 new HIs(type, <HInstruction>[expression, call], HIs.COMPOUND_CHECK); | 2862 new HIs(type, <HInstruction>[expression, call], HIs.COMPOUND_CHECK); |
2864 } else { | 2863 } else { |
2865 return new HIs(type, <HInstruction>[expression], HIs.RAW_CHECK); | 2864 return new HIs(type, <HInstruction>[expression], HIs.RAW_CHECK); |
(...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5404 new HSubGraphBlockInformation(elseBranch.graph)); | 5403 new HSubGraphBlockInformation(elseBranch.graph)); |
5405 | 5404 |
5406 HBasicBlock conditionStartBlock = conditionBranch.block; | 5405 HBasicBlock conditionStartBlock = conditionBranch.block; |
5407 conditionStartBlock.setBlockFlow(info, joinBlock); | 5406 conditionStartBlock.setBlockFlow(info, joinBlock); |
5408 SubGraph conditionGraph = conditionBranch.graph; | 5407 SubGraph conditionGraph = conditionBranch.graph; |
5409 HIf branch = conditionGraph.end.last; | 5408 HIf branch = conditionGraph.end.last; |
5410 assert(branch is HIf); | 5409 assert(branch is HIf); |
5411 branch.blockInformation = conditionStartBlock.blockFlow; | 5410 branch.blockInformation = conditionStartBlock.blockFlow; |
5412 } | 5411 } |
5413 } | 5412 } |
OLD | NEW |