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

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: Handle function types in checked mode. 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 915908fe6da702fb71eb601c751c0f2adbb612f9..dcbf95f1f8605e8d5b187c87d41291127f139fcf 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
@@ -2239,6 +2239,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;
@@ -2250,7 +2251,8 @@ 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);
sourceElement = input.sourceElement;
instructionType = type;
@@ -2259,7 +2261,18 @@ 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 {
+ 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 {
sourceElement = input.sourceElement;
instructionType = type;
@@ -2268,6 +2281,9 @@ class HTypeConversion extends HCheck {
bool get hasTypeRepresentation => inputs.length > 1;
HInstruction get typeRepresentation => inputs[1];
+ bool get hasContext => inputs.length > 1;
+ 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