Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 22903036: Use predicates to check simple function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 HInstruction representations = buildTypeArgumentRepresentations(type); 1769 HInstruction representations = buildTypeArgumentRepresentations(type);
1770 add(representations); 1770 add(representations);
1771 return new HTypeConversion.withTypeRepresentation(type, kind, subtype, 1771 return new HTypeConversion.withTypeRepresentation(type, kind, subtype,
1772 original, representations); 1772 original, representations);
1773 } else if (type.kind == TypeKind.TYPE_VARIABLE) { 1773 } else if (type.kind == TypeKind.TYPE_VARIABLE) {
1774 HType subtype = original.instructionType; 1774 HType subtype = original.instructionType;
1775 HInstruction typeVariable = addTypeVariableReference(type); 1775 HInstruction typeVariable = addTypeVariableReference(type);
1776 return new HTypeConversion.withTypeRepresentation(type, kind, subtype, 1776 return new HTypeConversion.withTypeRepresentation(type, kind, subtype,
1777 original, typeVariable); 1777 original, typeVariable);
1778 } else if (type.kind == TypeKind.FUNCTION) { 1778 } else if (type.kind == TypeKind.FUNCTION) {
1779 if (backend.rti.isSimpleFunctionType(type)) {
1780 return original.convertType(compiler, type, kind);
1781 }
1779 HType subtype = original.instructionType; 1782 HType subtype = original.instructionType;
1780 if (type.containsTypeVariables) { 1783 if (type.containsTypeVariables) {
1781 bool contextIsTypeArguments = false; 1784 bool contextIsTypeArguments = false;
1782 HInstruction context; 1785 HInstruction context;
1783 if (currentElement.isInstanceMember()) { 1786 if (currentElement.isInstanceMember()) {
1784 context = localsHandler.readThis(); 1787 context = localsHandler.readThis();
1785 } else { 1788 } else {
1786 ClassElement contextClass = Types.getClassContext(type); 1789 ClassElement contextClass = Types.getClassContext(type);
1787 context = buildTypeVariableList(contextClass); 1790 context = buildTypeVariableList(contextClass);
1788 add(context); 1791 add(context);
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2787 !link.isEmpty; 2790 !link.isEmpty;
2788 link = link.tail) { 2791 link = link.tail) {
2789 inputs.add(addTypeVariableReference(link.head)); 2792 inputs.add(addTypeVariableReference(link.head));
2790 } 2793 }
2791 return buildLiteralList(inputs); 2794 return buildLiteralList(inputs);
2792 } 2795 }
2793 2796
2794 HInstruction buildIsNode(Node node, DartType type, HInstruction expression) { 2797 HInstruction buildIsNode(Node node, DartType type, HInstruction expression) {
2795 type = type.unalias(compiler); 2798 type = type.unalias(compiler);
2796 if (type.kind == TypeKind.FUNCTION) { 2799 if (type.kind == TypeKind.FUNCTION) {
2800 if (backend.rti.isSimpleFunctionType(type)) {
2801 return new HIs(type, <HInstruction>[expression], HIs.RAW_CHECK);
2802 }
2797 Element checkFunctionSubtype = backend.getCheckFunctionSubtype(); 2803 Element checkFunctionSubtype = backend.getCheckFunctionSubtype();
2798 2804
2799 HInstruction signatureName = graph.addConstantString( 2805 HInstruction signatureName = graph.addConstantString(
2800 new DartString.literal(backend.namer.getFunctionTypeName(type)), 2806 new DartString.literal(backend.namer.getFunctionTypeName(type)),
2801 node, compiler); 2807 node, compiler);
2802 2808
2803 HInstruction contextName; 2809 HInstruction contextName;
2804 HInstruction context; 2810 HInstruction context;
2805 HInstruction typeArguments; 2811 HInstruction typeArguments;
2806 if (type.containsTypeVariables) { 2812 if (type.containsTypeVariables) {
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
5463 new HSubGraphBlockInformation(elseBranch.graph)); 5469 new HSubGraphBlockInformation(elseBranch.graph));
5464 5470
5465 HBasicBlock conditionStartBlock = conditionBranch.block; 5471 HBasicBlock conditionStartBlock = conditionBranch.block;
5466 conditionStartBlock.setBlockFlow(info, joinBlock); 5472 conditionStartBlock.setBlockFlow(info, joinBlock);
5467 SubGraph conditionGraph = conditionBranch.graph; 5473 SubGraph conditionGraph = conditionBranch.graph;
5468 HIf branch = conditionGraph.end.last; 5474 HIf branch = conditionGraph.end.last;
5469 assert(branch is HIf); 5475 assert(branch is HIf);
5470 branch.blockInformation = conditionStartBlock.blockFlow; 5476 branch.blockInformation = conditionStartBlock.blockFlow;
5471 } 5477 }
5472 } 5478 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698