Chromium Code Reviews| 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 interface HVisitor<R> { | 5 interface HVisitor<R> { |
| 6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
| 7 R visitBitAnd(HBitAnd node); | 7 R visitBitAnd(HBitAnd node); |
| 8 R visitBitNot(HBitNot node); | 8 R visitBitNot(HBitNot node); |
| 9 R visitBitOr(HBitOr node); | 9 R visitBitOr(HBitOr node); |
| 10 R visitBitXor(HBitXor node); | 10 R visitBitXor(HBitXor node); |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 995 bool isStatement() => true; | 995 bool isStatement() => true; |
| 996 void prepareGvn() { | 996 void prepareGvn() { |
| 997 assert(!hasSideEffects()); | 997 assert(!hasSideEffects()); |
| 998 setUseGvn(); | 998 setUseGvn(); |
| 999 } | 999 } |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 class HTypeGuard extends HCheck { | 1002 class HTypeGuard extends HCheck { |
| 1003 final int state; | 1003 final int state; |
| 1004 final HType guardedType; | 1004 final HType guardedType; |
| 1005 bool isOn = false; | 1005 bool isOn = false; |
|
Lasse Reichstein Nielsen
2012/06/27 10:08:38
What does "isOn" mean? Could it get a better name?
floitsch
2012/06/27 12:23:02
renamed to isEnabled.
done.
| |
| 1006 int checkedInputIndex = 0; | 1006 int checkedInputIndex = 0; |
| 1007 | 1007 |
| 1008 HTypeGuard(this.guardedType, this.state, List<HInstruction> env) : super(env); | 1008 HTypeGuard(this.guardedType, this.state, List<HInstruction> env) : super(env); |
| 1009 | 1009 |
| 1010 HInstruction get guarded() => inputs[checkedInputIndex]; | 1010 HInstruction get guarded() => inputs[checkedInputIndex]; |
| 1011 HInstruction get checkedInput() => guarded; | 1011 HInstruction get checkedInput() => guarded; |
| 1012 | 1012 |
| 1013 HType computeTypeFromInputTypes() { | 1013 HType computeTypeFromInputTypes() { |
| 1014 return isOn ? guardedType : guarded.propagatedType; | 1014 return isOn ? guardedType : guarded.propagatedType; |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 HType get guaranteedType() => isOn ? guardedType : HType.UNKNOWN; | 1017 HType get guaranteedType() => isOn ? guardedType : HType.UNKNOWN; |
| 1018 | 1018 |
| 1019 bool isControlFlow() => true; | 1019 bool isControlFlow() => true; |
| 1020 | 1020 |
| 1021 bool isStatement() => isOn; | |
| 1022 | |
| 1021 accept(HVisitor visitor) => visitor.visitTypeGuard(this); | 1023 accept(HVisitor visitor) => visitor.visitTypeGuard(this); |
| 1022 int typeCode() => 1; | 1024 int typeCode() => 1; |
| 1023 bool typeEquals(other) => other is HTypeGuard; | 1025 bool typeEquals(other) => other is HTypeGuard; |
| 1024 bool dataEquals(HTypeGuard other) { | 1026 bool dataEquals(HTypeGuard other) { |
| 1025 return guarded == other.guarded && guardedType == other.guardedType; | 1027 return guarded == other.guarded && guardedType == other.guardedType; |
| 1026 } | 1028 } |
| 1027 } | 1029 } |
| 1028 | 1030 |
| 1029 class HBoundsCheck extends HCheck { | 1031 class HBoundsCheck extends HCheck { |
| 1030 static final int ALWAYS_FALSE = 0; | 1032 static final int ALWAYS_FALSE = 0; |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2628 HBasicBlock get start() => expression.start; | 2630 HBasicBlock get start() => expression.start; |
| 2629 HBasicBlock get end() { | 2631 HBasicBlock get end() { |
| 2630 // We don't create a switch block if there are no cases. | 2632 // We don't create a switch block if there are no cases. |
| 2631 assert(!statements.isEmpty()); | 2633 assert(!statements.isEmpty()); |
| 2632 return statements.last().end; | 2634 return statements.last().end; |
| 2633 } | 2635 } |
| 2634 | 2636 |
| 2635 bool accept(HStatementInformationVisitor visitor) => | 2637 bool accept(HStatementInformationVisitor visitor) => |
| 2636 visitor.visitSwitchInfo(this); | 2638 visitor.visitSwitchInfo(this); |
| 2637 } | 2639 } |
| OLD | NEW |