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

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

Issue 15299002: Reapply "Enable full type-checks in checked mode." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update test expectations. Created 7 years, 7 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 2d9c62a1dd6c88c157346b9aa3617fa855d71c14..09df7c19cc9550e28a097d8b4d37b6a94b5ba67e 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)) {
+ 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) {
+ // 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