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

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

Issue 54983007: Make test of malformed types a dynamic type error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 return graph.addConstantBool(false, compiler); 587 return graph.addConstantBool(false, compiler);
588 } 588 }
589 } 589 }
590 return node; 590 return node;
591 } 591 }
592 592
593 HInstruction visitTypeConversion(HTypeConversion node) { 593 HInstruction visitTypeConversion(HTypeConversion node) {
594 HInstruction value = node.inputs[0]; 594 HInstruction value = node.inputs[0];
595 DartType type = node.typeExpression; 595 DartType type = node.typeExpression;
596 if (type != null) { 596 if (type != null) {
597 if (type.kind == TypeKind.MALFORMED_TYPE) {
598 // Malformed types are treated as dynamic statically, but should
599 // throw a type error at runtime.
600 return node;
601 }
597 if (!type.treatAsRaw || type.kind == TypeKind.TYPE_VARIABLE) { 602 if (!type.treatAsRaw || type.kind == TypeKind.TYPE_VARIABLE) {
598 return node; 603 return node;
599 } 604 }
600 if (type.kind == TypeKind.FUNCTION) { 605 if (type.kind == TypeKind.FUNCTION) {
601 // TODO(johnniwinther): Optimize function type conversions. 606 // TODO(johnniwinther): Optimize function type conversions.
602 return node; 607 return node;
603 } 608 }
604 } 609 }
605 return removeIfCheckAlwaysSucceeds(node, node.checkedType); 610 return removeIfCheckAlwaysSucceeds(node, node.checkedType);
606 } 611 }
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 // that knows it is not of a specific Type. 1517 // that knows it is not of a specific Type.
1513 } 1518 }
1514 1519
1515 for (HIf ifUser in notIfUsers) { 1520 for (HIf ifUser in notIfUsers) {
1516 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); 1521 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType);
1517 // TODO(ngeoffray): Also change uses for the then block on a HType 1522 // TODO(ngeoffray): Also change uses for the then block on a HType
1518 // that knows it is not of a specific Type. 1523 // that knows it is not of a specific Type.
1519 } 1524 }
1520 } 1525 }
1521 } 1526 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | sdk/lib/_internal/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698