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

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

Issue 24615003: Add DartType.treatAsRaw to treat List<dynamic> as List in the backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 return graph.addConstantBool(false, compiler); 644 return graph.addConstantBool(false, compiler);
645 } 645 }
646 } 646 }
647 return node; 647 return node;
648 } 648 }
649 649
650 HInstruction visitTypeConversion(HTypeConversion node) { 650 HInstruction visitTypeConversion(HTypeConversion node) {
651 HInstruction value = node.inputs[0]; 651 HInstruction value = node.inputs[0];
652 DartType type = node.typeExpression; 652 DartType type = node.typeExpression;
653 if (type != null) { 653 if (type != null) {
654 if (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE) { 654 if (!type.treatAsRaw || type.kind == TypeKind.TYPE_VARIABLE) {
655 return node; 655 return node;
656 } 656 }
657 if (type.kind == TypeKind.FUNCTION) { 657 if (type.kind == TypeKind.FUNCTION) {
658 // TODO(johnniwinther): Optimize function type conversions. 658 // TODO(johnniwinther): Optimize function type conversions.
659 return node; 659 return node;
660 } 660 }
661 } 661 }
662 HType convertedType = node.instructionType; 662 HType convertedType = node.instructionType;
663 if (convertedType.isUnknown()) return node; 663 if (convertedType.isUnknown()) return node;
664 HType combinedType = value.instructionType.intersection( 664 HType combinedType = value.instructionType.intersection(
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 762
763 HInstruction receiver = node.getDartReceiver(compiler); 763 HInstruction receiver = node.getDartReceiver(compiler);
764 Element field = findConcreteFieldForDynamicAccess(receiver, node.selector); 764 Element field = findConcreteFieldForDynamicAccess(receiver, node.selector);
765 if (field == null || !field.isAssignable()) return node; 765 if (field == null || !field.isAssignable()) return node;
766 // Use [:node.inputs.last:] in case the call follows the 766 // Use [:node.inputs.last:] in case the call follows the
767 // interceptor calling convention, but is not a call on an 767 // interceptor calling convention, but is not a call on an
768 // interceptor. 768 // interceptor.
769 HInstruction value = node.inputs.last; 769 HInstruction value = node.inputs.last;
770 if (compiler.enableTypeAssertions) { 770 if (compiler.enableTypeAssertions) {
771 DartType type = field.computeType(compiler); 771 DartType type = field.computeType(compiler);
772 if (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE) { 772 if (!type.treatAsRaw || type.kind == TypeKind.TYPE_VARIABLE) {
773 // We cannot generate the correct type representation here, so don't 773 // We cannot generate the correct type representation here, so don't
774 // inline this access. 774 // inline this access.
775 return node; 775 return node;
776 } 776 }
777 HInstruction other = value.convertType( 777 HInstruction other = value.convertType(
778 compiler, 778 compiler,
779 type, 779 type,
780 HTypeConversion.CHECKED_MODE_CHECK); 780 HTypeConversion.CHECKED_MODE_CHECK);
781 if (other != value) { 781 if (other != value) {
782 node.block.addBefore(node, other); 782 node.block.addBefore(node, other);
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 // that knows it is not of a specific Type. 1551 // that knows it is not of a specific Type.
1552 } 1552 }
1553 1553
1554 for (HIf ifUser in notIfUsers) { 1554 for (HIf ifUser in notIfUsers) {
1555 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); 1555 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType);
1556 // TODO(ngeoffray): Also change uses for the then block on a HType 1556 // TODO(ngeoffray): Also change uses for the then block on a HType
1557 // that knows it is not of a specific Type. 1557 // that knows it is not of a specific Type.
1558 } 1558 }
1559 } 1559 }
1560 } 1560 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698