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

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

Issue 12310103: Small cleanups in RegExp to avoid generating lots of code just because there is a try/catch in our … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 visitBasicBlock(HBasicBlock block) { 131 visitBasicBlock(HBasicBlock block) {
132 HInstruction instruction = block.first; 132 HInstruction instruction = block.first;
133 while (instruction != null) { 133 while (instruction != null) {
134 HInstruction next = instruction.next; 134 HInstruction next = instruction.next;
135 HInstruction replacement = instruction.accept(this); 135 HInstruction replacement = instruction.accept(this);
136 if (replacement != instruction) { 136 if (replacement != instruction) {
137 block.rewrite(instruction, replacement); 137 block.rewrite(instruction, replacement);
138 138
139 // If we can replace [instruction] with [replacement], then 139 // If we can replace [instruction] with [replacement], then
140 // [replacement]'s type can be narrowed. 140 // [replacement]'s type can be narrowed.
141 replacement.instructionType = replacement.instructionType.intersection( 141 HType newType = replacement.instructionType.intersection(
142 instruction.instructionType, compiler); 142 instruction.instructionType, compiler);
143 if (!newType.isConflicting()) {
144 // [HType.intersection] may give up when doing the
145 // intersection of two types is too complicated, and return
146 // [HType.CONFLICTING]. We do not want instructions to have
147 // [HType.CONFLICTING], so we only update the type if the
148 // intersection did not give up.
149 replacement.instructionType = newType;
150 }
143 151
144 // If the replacement instruction does not know its 152 // If the replacement instruction does not know its
145 // source element, use the source element of the 153 // source element, use the source element of the
146 // instruction. 154 // instruction.
147 if (replacement.sourceElement == null) { 155 if (replacement.sourceElement == null) {
148 replacement.sourceElement = instruction.sourceElement; 156 replacement.sourceElement = instruction.sourceElement;
149 } 157 }
150 if (replacement.sourcePosition == null) { 158 if (replacement.sourcePosition == null) {
151 replacement.sourcePosition = instruction.sourcePosition; 159 replacement.sourcePosition = instruction.sourcePosition;
152 } 160 }
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 HBasicBlock block = user.block; 1534 HBasicBlock block = user.block;
1527 block.addAfter(user, interceptor); 1535 block.addAfter(user, interceptor);
1528 block.rewrite(user, interceptor); 1536 block.rewrite(user, interceptor);
1529 block.remove(user); 1537 block.remove(user);
1530 1538
1531 // The interceptor will be removed in the dead code elimination 1539 // The interceptor will be removed in the dead code elimination
1532 // phase. Note that removing it here would not work because of how 1540 // phase. Note that removing it here would not work because of how
1533 // the [visitBasicBlock] is implemented. 1541 // the [visitBasicBlock] is implemented.
1534 } 1542 }
1535 } 1543 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698