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

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

Issue 11953044: Do not eliminate instructions that might throw. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 } 788 }
789 789
790 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase { 790 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase {
791 final HTypeMap types; 791 final HTypeMap types;
792 final String name = "SsaDeadCodeEliminator"; 792 final String name = "SsaDeadCodeEliminator";
793 793
794 SsaDeadCodeEliminator(this.types); 794 SsaDeadCodeEliminator(this.types);
795 795
796 bool isDeadCode(HInstruction instruction) { 796 bool isDeadCode(HInstruction instruction) {
797 return !instruction.hasSideEffects() 797 return !instruction.hasSideEffects()
798 && !instruction.canThrow()
798 && instruction.usedBy.isEmpty 799 && instruction.usedBy.isEmpty
799 // A dynamic getter that has no side effect can still throw
800 // a NoSuchMethodError.
801 && instruction is !HInvokeDynamicGetter
802 && instruction is !HCheck
803 && instruction is !HTypeGuard 800 && instruction is !HTypeGuard
804 && instruction is !HParameterValue 801 && instruction is !HParameterValue
805 && instruction is !HLocalSet 802 && instruction is !HLocalSet
806 && !instruction.isControlFlow(); 803 && !instruction.isControlFlow();
807 } 804 }
808 805
809 void visitGraph(HGraph graph) { 806 void visitGraph(HGraph graph) {
810 visitPostDominatorTree(graph); 807 visitPostDominatorTree(graph);
811 } 808 }
812 809
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 || otherIntercepted.contains(backend.jsDoubleClass)) { 1438 || otherIntercepted.contains(backend.jsDoubleClass)) {
1442 interceptor.interceptedClasses.addAll(user.interceptedClasses); 1439 interceptor.interceptedClasses.addAll(user.interceptedClasses);
1443 } 1440 }
1444 user.interceptedClasses = interceptor.interceptedClasses; 1441 user.interceptedClasses = interceptor.interceptedClasses;
1445 } 1442 }
1446 } 1443 }
1447 } 1444 }
1448 1445
1449 // TODO(ngeoffray): Also implement it for non-intercepted calls. 1446 // TODO(ngeoffray): Also implement it for non-intercepted calls.
1450 } 1447 }
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