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

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

Issue 12210142: Implement is-checks against type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Restore comment. Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 916b4db455b607d3cadbc8515509c6cd046c6906..49e12e816ec63a460f4314ec4d08f83b0d21e5ba 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -2642,16 +2642,23 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
}
return;
}
- if (type.element.isTypeVariable()) {
- // TODO(karlklose): remove this check when the backend can deal with
- // checks of the form [:o is T:] where [:T:] is a type variable.
- stack.add(graph.addConstantBool(true, constantSystem));
- return;
- }
HInstruction instruction;
- if (type.element.isTypeVariable() ||
- RuntimeTypeInformation.hasTypeArguments(type)) {
+ if (type.element.isTypeVariable()) {
ngeoffray 2013/02/18 09:27:58 Don't we have a check on the type to know if it's
karlklose 2013/02/18 16:02:01 No, we only have these helpers on elements. Replac
+ List<HInstruction> representations =
+ buildTypeArgumentRepresentations(type);
+ assert(representations.length == 1);
+ HInstruction runtimeType = representations[0];
ngeoffray 2013/02/18 09:27:58 Instead of asserting it's 1 and fetching the first
karlklose 2013/02/18 16:02:01 Done.
+ Element helper =
+ compiler.findHelper(const SourceString('objectIsSubtype'));
+ HInstruction helperCall = new HStatic(helper);
+ add(helperCall);
+ List<HInstruction> inputs = <HInstruction>[helperCall, expression,
+ runtimeType];
+ instruction = new HInvokeStatic(inputs, HType.UNKNOWN);
ngeoffray 2013/02/18 09:27:58 HType.BOOLEAN?
karlklose 2013/02/18 16:02:01 Done.
+ add(instruction);
ngeoffray 2013/02/18 09:27:58 Register in codegen world?
karlklose 2013/02/18 16:02:01 Done.
+
+ } else if (RuntimeTypeInformation.hasTypeArguments(type)) {
void argumentsCheck() {
HInstruction typeInfo = getRuntimeTypeInfo(expression);
@@ -2681,7 +2688,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
void classCheck() { push(new HIs(type, <HInstruction>[expression])); }
SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this, node);
- branchBuilder.handleLogicalAndOr(classCheck, argumentsCheck, isAnd: true);
+ branchBuilder.handleLogicalAndOr(classCheck, argumentsCheck,
+ isAnd: true);
instruction = pop();
} else {
instruction = new HIs(type, <HInstruction>[expression]);

Powered by Google App Engine
This is Rietveld 408576698