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

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

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix status files Created 7 years, 6 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/nodes.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
index 3f47849b369b465680dc3bcf56aa2d340402e932..5dccf1b53e04a9bd7ff6ca4770b8d3bd44f403e6 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
@@ -1110,6 +1110,7 @@ abstract class HInstruction implements Spannable {
HInstruction convertType(Compiler compiler, DartType type, int kind) {
if (type == null) return this;
+ type = type.unalias(compiler);
// Only the builder knows how to create [HTypeConversion]
// instructions with generics. It has the generic type context
// available.
@@ -1117,7 +1118,6 @@ abstract class HInstruction implements Spannable {
// TODO(5022): Generic typedefs should not be handled here.
karlklose 2013/06/20 07:32:55 This TODO is obsolete now.
Johnni Winther 2013/06/21 12:19:15 Removed.
assert(type.isRaw
|| type.isMalformed
- || type.kind == TypeKind.TYPEDEF
|| type.kind == TypeKind.FUNCTION);
if (identical(type.element, compiler.dynamicClass)) return this;
if (identical(type.element, compiler.objectClass)) return this;
@@ -2251,6 +2251,7 @@ class HTypeConversion extends HCheck {
final DartType typeExpression;
final int kind;
final Selector receiverTypeCheckSelector;
+ final bool contextIsTypeArguments;
static const int NO_CHECK = 0;
static const int CHECKED_MODE_CHECK = 1;
@@ -2262,8 +2263,11 @@ class HTypeConversion extends HCheck {
HTypeConversion(this.typeExpression, this.kind,
HType type, HInstruction input,
[this.receiverTypeCheckSelector])
- : super(<HInstruction>[input]) {
+ : contextIsTypeArguments = false,
+ super(<HInstruction>[input]) {
assert(!isReceiverTypeCheck || receiverTypeCheckSelector != null);
+ assert(typeExpression == null ||
+ typeExpression.kind != TypeKind.TYPEDEF);
sourceElement = input.sourceElement;
instructionType = type;
}
@@ -2271,8 +2275,21 @@ class HTypeConversion extends HCheck {
HTypeConversion.withTypeRepresentation(this.typeExpression, this.kind,
HType type, HInstruction input,
HInstruction typeRepresentation)
- : super(<HInstruction>[input, typeRepresentation]),
+ : contextIsTypeArguments = false,
+ super(<HInstruction>[input, typeRepresentation]),
receiverTypeCheckSelector = null {
+ assert(typeExpression.kind != TypeKind.TYPEDEF);
+ sourceElement = input.sourceElement;
+ instructionType = type;
+ }
+
+ HTypeConversion.withContext(this.typeExpression, this.kind,
+ HType type, HInstruction input,
+ HInstruction context,
+ {bool this.contextIsTypeArguments})
+ : super(<HInstruction>[input, context]),
+ receiverTypeCheckSelector = null {
+ assert(typeExpression.kind != TypeKind.TYPEDEF);
sourceElement = input.sourceElement;
instructionType = type;
}
@@ -2280,6 +2297,9 @@ class HTypeConversion extends HCheck {
bool get hasTypeRepresentation => inputs.length > 1;
HInstruction get typeRepresentation => inputs[1];
+ bool get hasContext => inputs.length > 1;
karlklose 2013/06/20 07:32:55 So we distinguish an HIs withTypeRepresentation fr
Johnni Winther 2013/06/21 12:19:15 Done.
+ HInstruction get context => inputs[1];
+
HInstruction convertType(Compiler compiler, DartType type, int kind) {
if (typeExpression == type) return this;
return super.convertType(compiler, type, kind);

Powered by Google App Engine
This is Rietveld 408576698