| 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 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 // Otherwise it is a lazy initializer which does not have parameters. | 1800 // Otherwise it is a lazy initializer which does not have parameters. |
| 1801 assert(element is VariableElement); | 1801 assert(element is VariableElement); |
| 1802 } | 1802 } |
| 1803 } | 1803 } |
| 1804 | 1804 |
| 1805 HInstruction buildTypeConversion(HInstruction original, | 1805 HInstruction buildTypeConversion(HInstruction original, |
| 1806 DartType type, | 1806 DartType type, |
| 1807 int kind) { | 1807 int kind) { |
| 1808 if (type == null) return original; | 1808 if (type == null) return original; |
| 1809 type = type.unalias(compiler); | 1809 type = type.unalias(compiler); |
| 1810 if (type.kind == TypeKind.INTERFACE && !type.isRaw) { | 1810 if (type.kind == TypeKind.INTERFACE && !type.treatAsRaw) { |
| 1811 HType subtype = new HType.subtype(type, compiler); | 1811 HType subtype = new HType.subtype(type, compiler); |
| 1812 HInstruction representations = buildTypeArgumentRepresentations(type); | 1812 HInstruction representations = buildTypeArgumentRepresentations(type); |
| 1813 add(representations); | 1813 add(representations); |
| 1814 return new HTypeConversion.withTypeRepresentation(type, kind, subtype, | 1814 return new HTypeConversion.withTypeRepresentation(type, kind, subtype, |
| 1815 original, representations); | 1815 original, representations); |
| 1816 } else if (type.kind == TypeKind.TYPE_VARIABLE) { | 1816 } else if (type.kind == TypeKind.TYPE_VARIABLE) { |
| 1817 HType subtype = original.instructionType; | 1817 HType subtype = original.instructionType; |
| 1818 HInstruction typeVariable = addTypeVariableReference(type); | 1818 HInstruction typeVariable = addTypeVariableReference(type); |
| 1819 return new HTypeConversion.withTypeRepresentation(type, kind, subtype, | 1819 return new HTypeConversion.withTypeRepresentation(type, kind, subtype, |
| 1820 original, typeVariable); | 1820 original, typeVariable); |
| 1821 } else if (type.kind == TypeKind.FUNCTION) { | 1821 } else if (type.kind == TypeKind.FUNCTION) { |
| 1822 if (backend.rti.isSimpleFunctionType(type)) { | 1822 if (backend.rti.isSimpleFunctionType(type)) { |
| 1823 return original.convertType(compiler, type, kind); | 1823 return original.convertType(compiler, type, kind); |
| 1824 } | 1824 } |
| (...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3474 js.Expression code = js.js.parseForeignJS(template); | 3474 js.Expression code = js.js.parseForeignJS(template); |
| 3475 HInstruction result = createForeign(code, backend.stringType, inputs); | 3475 HInstruction result = createForeign(code, backend.stringType, inputs); |
| 3476 add(result); | 3476 add(result); |
| 3477 return result; | 3477 return result; |
| 3478 } | 3478 } |
| 3479 | 3479 |
| 3480 void handleListConstructor(InterfaceType type, | 3480 void handleListConstructor(InterfaceType type, |
| 3481 Node currentNode, | 3481 Node currentNode, |
| 3482 HInstruction newObject) { | 3482 HInstruction newObject) { |
| 3483 if (!backend.classNeedsRti(type.element)) return; | 3483 if (!backend.classNeedsRti(type.element)) return; |
| 3484 if (!type.isRaw) { | 3484 if (!type.treatAsRaw) { |
| 3485 List<HInstruction> inputs = <HInstruction>[]; | 3485 List<HInstruction> inputs = <HInstruction>[]; |
| 3486 type.typeArguments.forEach((DartType argument) { | 3486 type.typeArguments.forEach((DartType argument) { |
| 3487 inputs.add(analyzeTypeArgument(argument)); | 3487 inputs.add(analyzeTypeArgument(argument)); |
| 3488 }); | 3488 }); |
| 3489 callSetRuntimeTypeInfo(type.element, inputs, newObject); | 3489 callSetRuntimeTypeInfo(type.element, inputs, newObject); |
| 3490 } | 3490 } |
| 3491 } | 3491 } |
| 3492 | 3492 |
| 3493 void callSetRuntimeTypeInfo(ClassElement element, | 3493 void callSetRuntimeTypeInfo(ClassElement element, |
| 3494 List<HInstruction> rtiInputs, | 3494 List<HInstruction> rtiInputs, |
| (...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5560 new HSubGraphBlockInformation(elseBranch.graph)); | 5560 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5561 | 5561 |
| 5562 HBasicBlock conditionStartBlock = conditionBranch.block; | 5562 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5563 conditionStartBlock.setBlockFlow(info, joinBlock); | 5563 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5564 SubGraph conditionGraph = conditionBranch.graph; | 5564 SubGraph conditionGraph = conditionBranch.graph; |
| 5565 HIf branch = conditionGraph.end.last; | 5565 HIf branch = conditionGraph.end.last; |
| 5566 assert(branch is HIf); | 5566 assert(branch is HIf); |
| 5567 branch.blockInformation = conditionStartBlock.blockFlow; | 5567 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5568 } | 5568 } |
| 5569 } | 5569 } |
| OLD | NEW |