OLD | NEW |
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 abstract class HVisitor<R> { | 5 abstract class HVisitor<R> { |
6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
7 R visitBailoutTarget(HBailoutTarget node); | 7 R visitBailoutTarget(HBailoutTarget node); |
8 R visitBitAnd(HBitAnd node); | 8 R visitBitAnd(HBitAnd node); |
9 R visitBitNot(HBitNot node); | 9 R visitBitNot(HBitNot node); |
10 R visitBitOr(HBitOr node); | 10 R visitBitOr(HBitOr node); |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 bool contains(HInstruction instruction) { | 425 bool contains(HInstruction instruction) { |
426 HInstruction cursor = first; | 426 HInstruction cursor = first; |
427 while (cursor != null) { | 427 while (cursor != null) { |
428 if (cursor === instruction) return true; | 428 if (cursor === instruction) return true; |
429 cursor = cursor.next; | 429 cursor = cursor.next; |
430 } | 430 } |
431 return false; | 431 return false; |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 class HBasicBlock extends HInstructionList implements Hashable { | 435 class HBasicBlock extends HInstructionList { |
436 // The [id] must be such that any successor's id is greater than | 436 // The [id] must be such that any successor's id is greater than |
437 // this [id]. The exception are back-edges. | 437 // this [id]. The exception are back-edges. |
438 int id; | 438 int id; |
439 | 439 |
440 static const int STATUS_NEW = 0; | 440 static const int STATUS_NEW = 0; |
441 static const int STATUS_OPEN = 1; | 441 static const int STATUS_OPEN = 1; |
442 static const int STATUS_CLOSED = 2; | 442 static const int STATUS_CLOSED = 2; |
443 int status = STATUS_NEW; | 443 int status = STATUS_NEW; |
444 | 444 |
445 HInstructionList phis; | 445 HInstructionList phis; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 bool dominates(HBasicBlock other) { | 732 bool dominates(HBasicBlock other) { |
733 do { | 733 do { |
734 if (this === other) return true; | 734 if (this === other) return true; |
735 other = other.dominator; | 735 other = other.dominator; |
736 } while (other !== null && other.id >= id); | 736 } while (other !== null && other.id >= id); |
737 return false; | 737 return false; |
738 } | 738 } |
739 } | 739 } |
740 | 740 |
741 | 741 |
742 class HInstruction implements Hashable, Spannable { | 742 class HInstruction implements Spannable { |
743 Element sourceElement; | 743 Element sourceElement; |
744 SourceFileLocation sourcePosition; | 744 SourceFileLocation sourcePosition; |
745 | 745 |
746 final int id; | 746 final int id; |
747 static int idCounter; | 747 static int idCounter; |
748 | 748 |
749 final List<HInstruction> inputs; | 749 final List<HInstruction> inputs; |
750 final List<HInstruction> usedBy; | 750 final List<HInstruction> usedBy; |
751 | 751 |
752 HBasicBlock block; | 752 HBasicBlock block; |
(...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2904 HBasicBlock get start => expression.start; | 2904 HBasicBlock get start => expression.start; |
2905 HBasicBlock get end { | 2905 HBasicBlock get end { |
2906 // We don't create a switch block if there are no cases. | 2906 // We don't create a switch block if there are no cases. |
2907 assert(!statements.isEmpty()); | 2907 assert(!statements.isEmpty()); |
2908 return statements.last().end; | 2908 return statements.last().end; |
2909 } | 2909 } |
2910 | 2910 |
2911 bool accept(HStatementInformationVisitor visitor) => | 2911 bool accept(HStatementInformationVisitor visitor) => |
2912 visitor.visitSwitchInfo(this); | 2912 visitor.visitSwitchInfo(this); |
2913 } | 2913 } |
OLD | NEW |