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

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

Issue 11478022: Implement is-checks with typedefs for callable objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 return; 2733 return;
2734 } 2734 }
2735 if (type.element.isTypeVariable()) { 2735 if (type.element.isTypeVariable()) {
2736 // TODO(karlklose): remove this check when the backend can deal with 2736 // TODO(karlklose): remove this check when the backend can deal with
2737 // checks of the form [:o is T:] where [:T:] is a type variable. 2737 // checks of the form [:o is T:] where [:T:] is a type variable.
2738 stack.add(graph.addConstantBool(true, constantSystem)); 2738 stack.add(graph.addConstantBool(true, constantSystem));
2739 return; 2739 return;
2740 } 2740 }
2741 2741
2742 HInstruction instruction; 2742 HInstruction instruction;
2743 if (RuntimeTypeInformation.hasTypeArguments(type) || 2743 if ((RuntimeTypeInformation.hasTypeArguments(type) &&
2744 type.element.isTypeVariable()) { 2744 type.element.isClass()) || type.element.isTypeVariable()) {
floitsch 2012/12/07 15:30:15 this looks too much like && (... || ...) please br
karlklose 2012/12/11 08:40:05 The change was actually not necessary anymore. Rem
2745 HInstruction typeInfo = getRuntimeTypeInfo(expression); 2745 HInstruction typeInfo = getRuntimeTypeInfo(expression);
2746 // TODO(karlklose): make isSubtype a HInstruction to enable 2746 // TODO(karlklose): make isSubtype a HInstruction to enable
2747 // optimizations? 2747 // optimizations?
2748 Element helper = compiler.findHelper(const SourceString('isSubtype')); 2748 Element helper = compiler.findHelper(const SourceString('isSubtype'));
2749 HInstruction isSubtype = new HStatic(helper); 2749 HInstruction isSubtype = new HStatic(helper);
2750 add(isSubtype); 2750 add(isSubtype);
2751 // Build a list of representations for the type arguments. 2751 // Build a list of representations for the type arguments.
2752 List<HInstruction> representations = 2752 List<HInstruction> representations =
2753 buildTypeArgumentRepresentations(type); 2753 buildTypeArgumentRepresentations(type);
2754 // For each type argument, build a call to isSubtype, with the type 2754 // For each type argument, build a call to isSubtype, with the type
(...skipping 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4991 new HSubGraphBlockInformation(elseBranch.graph)); 4991 new HSubGraphBlockInformation(elseBranch.graph));
4992 4992
4993 HBasicBlock conditionStartBlock = conditionBranch.block; 4993 HBasicBlock conditionStartBlock = conditionBranch.block;
4994 conditionStartBlock.setBlockFlow(info, joinBlock); 4994 conditionStartBlock.setBlockFlow(info, joinBlock);
4995 SubGraph conditionGraph = conditionBranch.graph; 4995 SubGraph conditionGraph = conditionBranch.graph;
4996 HIf branch = conditionGraph.end.last; 4996 HIf branch = conditionGraph.end.last;
4997 assert(branch is HIf); 4997 assert(branch is HIf);
4998 branch.blockInformation = conditionStartBlock.blockFlow; 4998 branch.blockInformation = conditionStartBlock.blockFlow;
4999 } 4999 }
5000 } 5000 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698