| 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 721 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 { | 742 class HInstruction implements Hashable, Spanable { |
| 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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2360 | 2360 |
| 2361 class HThrow extends HControlFlow { | 2361 class HThrow extends HControlFlow { |
| 2362 final bool isRethrow; | 2362 final bool isRethrow; |
| 2363 HThrow(value, [this.isRethrow = false]) : super(<HInstruction>[value]); | 2363 HThrow(value, [this.isRethrow = false]) : super(<HInstruction>[value]); |
| 2364 toString() => 'throw'; | 2364 toString() => 'throw'; |
| 2365 accept(HVisitor visitor) => visitor.visitThrow(this); | 2365 accept(HVisitor visitor) => visitor.visitThrow(this); |
| 2366 } | 2366 } |
| 2367 | 2367 |
| 2368 class HStatic extends HInstruction { | 2368 class HStatic extends HInstruction { |
| 2369 final Element element; | 2369 final Element element; |
| 2370 HStatic(this.element) : super(<HInstruction>[]) { assert(element !== null); } | 2370 HStatic(this.element) : super(<HInstruction>[]) { |
| 2371 assert(element !== null); |
| 2372 assert(invariant(this, element.isDeclaration)); |
| 2373 } |
| 2371 | 2374 |
| 2372 void prepareGvn(HTypeMap types) { | 2375 void prepareGvn(HTypeMap types) { |
| 2373 if (!element.isAssignable()) { | 2376 if (!element.isAssignable()) { |
| 2374 clearAllSideEffects(); | 2377 clearAllSideEffects(); |
| 2375 setUseGvn(); | 2378 setUseGvn(); |
| 2376 } | 2379 } |
| 2377 } | 2380 } |
| 2378 toString() => 'static ${element.name}'; | 2381 toString() => 'static ${element.name}'; |
| 2379 accept(HVisitor visitor) => visitor.visitStatic(this); | 2382 accept(HVisitor visitor) => visitor.visitStatic(this); |
| 2380 | 2383 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2901 HBasicBlock get start => expression.start; | 2904 HBasicBlock get start => expression.start; |
| 2902 HBasicBlock get end { | 2905 HBasicBlock get end { |
| 2903 // 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. |
| 2904 assert(!statements.isEmpty()); | 2907 assert(!statements.isEmpty()); |
| 2905 return statements.last().end; | 2908 return statements.last().end; |
| 2906 } | 2909 } |
| 2907 | 2910 |
| 2908 bool accept(HStatementInformationVisitor visitor) => | 2911 bool accept(HStatementInformationVisitor visitor) => |
| 2909 visitor.visitSwitchInfo(this); | 2912 visitor.visitSwitchInfo(this); |
| 2910 } | 2913 } |
| OLD | NEW |