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

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

Issue 12082074: Fix another bailout problem where not all blocks were visiting when propagating bailout information… (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 HVisitor<R> { 7 abstract class HVisitor<R> {
8 R visitAdd(HAdd node); 8 R visitAdd(HAdd node);
9 R visitBailoutTarget(HBailoutTarget node); 9 R visitBailoutTarget(HBailoutTarget node);
10 R visitBitAnd(HBitAnd node); 10 R visitBitAnd(HBitAnd node);
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 1850
1851 final int kind; 1851 final int kind;
1852 HLoopBranch(HInstruction condition, [this.kind = CONDITION_FIRST_LOOP]) 1852 HLoopBranch(HInstruction condition, [this.kind = CONDITION_FIRST_LOOP])
1853 : super(<HInstruction>[condition]); 1853 : super(<HInstruction>[condition]);
1854 toString() => 'loop-branch'; 1854 toString() => 'loop-branch';
1855 accept(HVisitor visitor) => visitor.visitLoopBranch(this); 1855 accept(HVisitor visitor) => visitor.visitLoopBranch(this);
1856 1856
1857 bool isDoWhile() { 1857 bool isDoWhile() {
1858 return identical(kind, DO_WHILE_LOOP); 1858 return identical(kind, DO_WHILE_LOOP);
1859 } 1859 }
1860
1861 HBasicBlock computeLoopHeader() {
1862 HBasicBlock result;
1863 if (isDoWhile()) {
1864 // In case of a do/while, the successor is a block that avoids
1865 // a critical edge and branchs to the loop header.
1866 result = block.successors[0].successors[0];
1867 } else {
1868 // For other loops, the loop header might be up the dominator
1869 // tree if the loop condition has control flow.
1870 result = block;
1871 while (!result.isLoopHeader()) result = result.dominator;
1872 }
1873
1874 assert(result.isLoopHeader());
1875 return result;
1876 }
1860 } 1877 }
1861 1878
1862 class HConstant extends HInstruction { 1879 class HConstant extends HInstruction {
1863 final Constant constant; 1880 final Constant constant;
1864 final HType constantType; 1881 final HType constantType;
1865 HConstant.internal(this.constant, HType this.constantType) 1882 HConstant.internal(this.constant, HType this.constantType)
1866 : super(<HInstruction>[]); 1883 : super(<HInstruction>[]);
1867 1884
1868 toString() => 'literal: $constant'; 1885 toString() => 'literal: $constant';
1869 accept(HVisitor visitor) => visitor.visitConstant(this); 1886 accept(HVisitor visitor) => visitor.visitConstant(this);
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 if (kind == DO_WHILE_LOOP && condition != null) { 2628 if (kind == DO_WHILE_LOOP && condition != null) {
2612 return condition.end; 2629 return condition.end;
2613 } 2630 }
2614 return body.end; 2631 return body.end;
2615 } 2632 }
2616 2633
2617 static int loopType(Node node) { 2634 static int loopType(Node node) {
2618 return node.accept(const LoopTypeVisitor()); 2635 return node.accept(const LoopTypeVisitor());
2619 } 2636 }
2620 2637
2638 bool isDoWhile() => kind == DO_WHILE_LOOP;
2639
2621 bool accept(HStatementInformationVisitor visitor) => 2640 bool accept(HStatementInformationVisitor visitor) =>
2622 visitor.visitLoopInfo(this); 2641 visitor.visitLoopInfo(this);
2623 } 2642 }
2624 2643
2625 class HIfBlockInformation implements HStatementInformation { 2644 class HIfBlockInformation implements HStatementInformation {
2626 final HExpressionInformation condition; 2645 final HExpressionInformation condition;
2627 final HStatementInformation thenGraph; 2646 final HStatementInformation thenGraph;
2628 final HStatementInformation elseGraph; 2647 final HStatementInformation elseGraph;
2629 HIfBlockInformation(this.condition, 2648 HIfBlockInformation(this.condition,
2630 this.thenGraph, 2649 this.thenGraph,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 HBasicBlock get start => expression.start; 2715 HBasicBlock get start => expression.start;
2697 HBasicBlock get end { 2716 HBasicBlock get end {
2698 // We don't create a switch block if there are no cases. 2717 // We don't create a switch block if there are no cases.
2699 assert(!statements.isEmpty); 2718 assert(!statements.isEmpty);
2700 return statements.last.end; 2719 return statements.last.end;
2701 } 2720 }
2702 2721
2703 bool accept(HStatementInformationVisitor visitor) => 2722 bool accept(HStatementInformationVisitor visitor) =>
2704 visitor.visitSwitchInfo(this); 2723 visitor.visitSwitchInfo(this);
2705 } 2724 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | tests/language/bailout6_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698