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

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

Issue 13019003: Enable full type-checks in checked mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix a bug. Created 7 years, 8 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 c1b9796ec9cbe58f70e8ea5889df11e536d25935..3dada638bcdb7da3150efe2f22a810a44cab6855 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
@@ -2177,7 +2177,6 @@ class HIndexAssign extends HInstruction {
HInstruction get value => inputs[2];
}
-// TODO(karlklose): use this class to represent type conversions as well.
class HIs extends HInstruction {
/// A check against a raw type: 'o is int', 'o is A'.
static const int RAW_CHECK = 0;
@@ -2185,16 +2184,26 @@ class HIs extends HInstruction {
static const int COMPOUND_CHECK = 1;
/// A check against a single type variable: 'o is T'.
static const int VARIABLE_CHECK = 2;
+ /// A checked-mode check against a raw type.
+ static const int RAW_ASSERT = 3;
final DartType typeExpression;
final bool nullOk;
final int kind;
+ final bool isCheckedModeTest;
HIs(this.typeExpression, List<HInstruction> inputs, this.kind,
- {this.nullOk: false}) : super(inputs) {
- assert(kind >= RAW_CHECK && kind <= VARIABLE_CHECK);
- setUseGvn();
- instructionType = HType.BOOLEAN;
+ this.isCheckedModeTest, HType instructionType, {this.nullOk: false})
+ : super(inputs) {
+ assert(kind >= RAW_CHECK && kind <= RAW_ASSERT);
+ assert(isCheckedModeTest || instructionType == HType.BOOLEAN);
+ assert(isCheckedModeTest || instructionType != RAW_ASSERT);
+ if (isCheckedModeTest) {
+ setAllSideEffects();
+ } else {
+ setUseGvn();
+ }
+ this.instructionType = instructionType;
}
HInstruction get expression => inputs[0];
@@ -2204,6 +2213,7 @@ class HIs extends HInstruction {
return inputs[1];
}
+ bool canThrow() => isCheckedModeTest;
bool get isRawCheck => kind == RAW_CHECK;
bool get isVariableCheck => kind == VARIABLE_CHECK;
bool get isCompoundCheck => kind == COMPOUND_CHECK;

Powered by Google App Engine
This is Rietveld 408576698