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

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

Issue 13019003: Enable full type-checks in checked mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use HTypeConversion instead of HIs. 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/optimize.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
index 98b2725e87deabf4d55cc8606608f89a519cd5f7..05f5177346f772e3b112d950c63a325672877ea6 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
@@ -606,7 +606,9 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
HInstruction visitTypeConversion(HTypeConversion node) {
HInstruction value = node.inputs[0];
DartType type = node.typeExpression;
- if (type != null && !type.isRaw) return node;
+ if (type != null && (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE)) {
ngeoffray 2013/05/13 09:10:59 type.containsTypeVariable?
karlklose 2013/05/14 13:49:41 No, this also checks for literal type arguments.
ngeoffray 2013/05/15 08:45:32 I don't understand. Why isn't (!type.isRaw || type
+ return node;
+ }
HType convertedType = node.instructionType;
if (convertedType.isUnknown()) return node;
HType combinedType = value.instructionType.intersection(
@@ -723,9 +725,15 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
// interceptor.
HInstruction value = node.inputs.last;
if (compiler.enableTypeAssertions) {
+ DartType type = field.computeType(compiler);
+ if (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE) {
ngeoffray 2013/05/13 09:10:59 type.containsTypeVariable?
karlklose 2013/05/14 13:49:41 Ditto.
+ // We cannot generate the correct type representation here, so don't
+ // inline this access.
+ return node;
+ }
HInstruction other = value.convertType(
compiler,
- field.computeType(compiler),
+ type,
HTypeConversion.CHECKED_MODE_CHECK);
if (other != value) {
node.block.addBefore(node, other);

Powered by Google App Engine
This is Rietveld 408576698