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

Side by Side Diff: dart/frog/leg/ssa/optimize.dart

Issue 9570002: Add test inspired by Leg bug. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix the Leg bug. Created 8 years, 9 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 | dart/tests/language/src/Closure3Test.dart » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class SsaOptimizerTask extends CompilerTask { 5 class SsaOptimizerTask extends CompilerTask {
6 SsaOptimizerTask(Compiler compiler) : super(compiler); 6 SsaOptimizerTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA optimizer'; 7 String get name() => 'SSA optimizer';
8 8
9 void optimize(WorkItem work, HGraph graph) { 9 void optimize(WorkItem work, HGraph graph) {
10 measure(() { 10 measure(() {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 node.block.remove(node); 239 node.block.remove(node);
240 } 240 }
241 } 241 }
242 242
243 class SsaDeadCodeEliminator extends HGraphVisitor { 243 class SsaDeadCodeEliminator extends HGraphVisitor {
244 static bool isDeadCode(HInstruction instruction) { 244 static bool isDeadCode(HInstruction instruction) {
245 // TODO(ngeoffray): the way we handle side effects is not right 245 // TODO(ngeoffray): the way we handle side effects is not right
246 // (e.g. branching instructions have side effects). 246 // (e.g. branching instructions have side effects).
247 return !instruction.hasSideEffects() 247 return !instruction.hasSideEffects()
248 && instruction.usedBy.isEmpty() 248 && instruction.usedBy.isEmpty()
249 && instruction is !HCheck; 249 && instruction is !HCheck
250 && instruction is !HTypeGuard;
250 } 251 }
251 252
252 void visitGraph(HGraph graph) { 253 void visitGraph(HGraph graph) {
253 visitPostDominatorTree(graph); 254 visitPostDominatorTree(graph);
254 } 255 }
255 256
256 void visitBasicBlock(HBasicBlock block) { 257 void visitBasicBlock(HBasicBlock block) {
257 HInstruction instruction = block.last; 258 HInstruction instruction = block.last;
258 while (instruction !== null) { 259 while (instruction !== null) {
259 var previous = instruction.previous; 260 var previous = instruction.previous;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 } 612 }
612 } 613 }
613 if (!canBeMoved) continue; 614 if (!canBeMoved) continue;
614 615
615 // This is safe because we are running after GVN. 616 // This is safe because we are running after GVN.
616 // TODO(ngeoffray): ensure GVN has been run. 617 // TODO(ngeoffray): ensure GVN has been run.
617 set_.add(current); 618 set_.add(current);
618 } 619 }
619 } 620 }
620 } 621 }
OLDNEW
« no previous file with comments | « no previous file | dart/tests/language/src/Closure3Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698