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 2734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 HInstruction helperCall = new HStatic(helper); | 2745 HInstruction helperCall = new HStatic(helper); |
2746 add(helperCall); | 2746 add(helperCall); |
2747 List<HInstruction> inputs = <HInstruction>[helperCall, expression, | 2747 List<HInstruction> inputs = <HInstruction>[helperCall, expression, |
2748 runtimeType]; | 2748 runtimeType]; |
2749 HInstruction call = new HInvokeStatic(inputs, HType.BOOLEAN); | 2749 HInstruction call = new HInvokeStatic(inputs, HType.BOOLEAN); |
2750 add(call); | 2750 add(call); |
2751 instruction = new HIs(type, <HInstruction>[expression, call], | 2751 instruction = new HIs(type, <HInstruction>[expression, call], |
2752 HIs.VARIABLE_CHECK); | 2752 HIs.VARIABLE_CHECK); |
2753 } else if (RuntimeTypes.hasTypeArguments(type)) { | 2753 } else if (RuntimeTypes.hasTypeArguments(type)) { |
2754 Element element = type.element; | 2754 Element element = type.element; |
2755 bool needsNativeCheck = | |
2756 backend.emitter.nativeEmitter.requiresNativeIsCheck(element); | |
2757 Element helper = backend.getCheckSubtype(); | 2755 Element helper = backend.getCheckSubtype(); |
2758 HInstruction helperCall = new HStatic(helper); | 2756 HInstruction helperCall = new HStatic(helper); |
2759 add(helperCall); | 2757 add(helperCall); |
2760 HInstruction representations = | 2758 HInstruction representations = |
2761 buildTypeArgumentRepresentations(type); | 2759 buildTypeArgumentRepresentations(type); |
2762 add(representations); | 2760 add(representations); |
2763 HInstruction isFieldName = | 2761 HInstruction isFieldName = |
2764 addConstantString(node, backend.namer.operatorIs(element)); | 2762 addConstantString(node, backend.namer.operatorIs(element)); |
2765 // TODO(karlklose): use [:null:] for [asField] if [element] does not | 2763 // TODO(karlklose): use [:null:] for [asField] if [element] does not |
2766 // have a subclass. | 2764 // have a subclass. |
2767 HInstruction asFieldName = | 2765 HInstruction asFieldName = |
2768 addConstantString(node, backend.namer.substitutionName(element)); | 2766 addConstantString(node, backend.namer.substitutionName(element)); |
2769 HInstruction native = | |
2770 graph.addConstantBool(needsNativeCheck, constantSystem); | |
2771 List<HInstruction> inputs = <HInstruction>[helperCall, | 2767 List<HInstruction> inputs = <HInstruction>[helperCall, |
2772 expression, | 2768 expression, |
2773 isFieldName, | 2769 isFieldName, |
2774 representations, | 2770 representations, |
2775 asFieldName, | 2771 asFieldName]; |
2776 native]; | |
2777 HInstruction call = new HInvokeStatic(inputs, HType.BOOLEAN); | 2772 HInstruction call = new HInvokeStatic(inputs, HType.BOOLEAN); |
2778 add(call); | 2773 add(call); |
2779 instruction = new HIs(type, <HInstruction>[expression, call], | 2774 instruction = new HIs(type, <HInstruction>[expression, call], |
2780 HIs.COMPOUND_CHECK); | 2775 HIs.COMPOUND_CHECK); |
2781 } else { | 2776 } else { |
2782 instruction = new HIs(type, <HInstruction>[expression], HIs.RAW_CHECK); | 2777 instruction = new HIs(type, <HInstruction>[expression], HIs.RAW_CHECK); |
2783 } | 2778 } |
2784 if (isNot) { | 2779 if (isNot) { |
2785 add(instruction); | 2780 add(instruction); |
2786 instruction = new HNot(instruction); | 2781 instruction = new HNot(instruction); |
(...skipping 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5231 new HSubGraphBlockInformation(elseBranch.graph)); | 5226 new HSubGraphBlockInformation(elseBranch.graph)); |
5232 | 5227 |
5233 HBasicBlock conditionStartBlock = conditionBranch.block; | 5228 HBasicBlock conditionStartBlock = conditionBranch.block; |
5234 conditionStartBlock.setBlockFlow(info, joinBlock); | 5229 conditionStartBlock.setBlockFlow(info, joinBlock); |
5235 SubGraph conditionGraph = conditionBranch.graph; | 5230 SubGraph conditionGraph = conditionBranch.graph; |
5236 HIf branch = conditionGraph.end.last; | 5231 HIf branch = conditionGraph.end.last; |
5237 assert(branch is HIf); | 5232 assert(branch is HIf); |
5238 branch.blockInformation = conditionStartBlock.blockFlow; | 5233 branch.blockInformation = conditionStartBlock.blockFlow; |
5239 } | 5234 } |
5240 } | 5235 } |
OLD | NEW |