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

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

Issue 155393002: Replace dead instructions with a constant with no type (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase { 887 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase {
888 final String name = "SsaDeadCodeEliminator"; 888 final String name = "SsaDeadCodeEliminator";
889 889
890 final Compiler compiler; 890 final Compiler compiler;
891 SsaLiveBlockAnalyzer analyzer; 891 SsaLiveBlockAnalyzer analyzer;
892 bool eliminatedSideEffects = false; 892 bool eliminatedSideEffects = false;
893 SsaDeadCodeEliminator(this.compiler); 893 SsaDeadCodeEliminator(this.compiler);
894 894
895 HInstruction zapInstructionCache; 895 HInstruction zapInstructionCache;
896 HInstruction get zapInstruction { 896 HInstruction get zapInstruction {
897 return (zapInstructionCache == null) 897 if (zapInstructionCache == null) {
898 ? zapInstructionCache = analyzer.graph.addConstantInt(0, compiler) 898 // A constant with no type does not pollute types at phi nodes.
899 : zapInstructionCache; 899 Constant constant =
900 new DummyReceiverConstant(const TypeMask.nonNullEmpty());
901 zapInstructionCache = analyzer.graph.addConstant(constant, compiler);
902 }
903 return zapInstructionCache;
900 } 904 }
901 905
902 /// Returns whether the next throwing instruction that may have side 906 /// Returns whether the next throwing instruction that may have side
903 /// effects after [instruction], throws [NoSuchMethodError] on the 907 /// effects after [instruction], throws [NoSuchMethodError] on the
904 /// same receiver of [instruction]. 908 /// same receiver of [instruction].
905 bool hasFollowingThrowingNSM(HInstruction instruction) { 909 bool hasFollowingThrowingNSM(HInstruction instruction) {
906 HInstruction receiver = instruction.getDartReceiver(compiler); 910 HInstruction receiver = instruction.getDartReceiver(compiler);
907 HInstruction current = instruction.next; 911 HInstruction current = instruction.next;
908 do { 912 do {
909 if ((current.getDartReceiver(compiler) == receiver) 913 if ((current.getDartReceiver(compiler) == receiver)
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 1969
1966 keyedValues.forEach((receiver, values) { 1970 keyedValues.forEach((receiver, values) {
1967 result.keyedValues[receiver] = 1971 result.keyedValues[receiver] =
1968 new Map<HInstruction, HInstruction>.from(values); 1972 new Map<HInstruction, HInstruction>.from(values);
1969 }); 1973 });
1970 1974
1971 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 1975 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
1972 return result; 1976 return result;
1973 } 1977 }
1974 } 1978 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698