| 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 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2520 } | 2520 } |
| 2521 | 2521 |
| 2522 class HTypeConversion extends HCheck { | 2522 class HTypeConversion extends HCheck { |
| 2523 HType type; | 2523 HType type; |
| 2524 final int kind; | 2524 final int kind; |
| 2525 | 2525 |
| 2526 static const int NO_CHECK = 0; | 2526 static const int NO_CHECK = 0; |
| 2527 static const int CHECKED_MODE_CHECK = 1; | 2527 static const int CHECKED_MODE_CHECK = 1; |
| 2528 static const int ARGUMENT_TYPE_CHECK = 2; | 2528 static const int ARGUMENT_TYPE_CHECK = 2; |
| 2529 static const int CAST_TYPE_CHECK = 3; | 2529 static const int CAST_TYPE_CHECK = 3; |
| 2530 static const int BOOLEAN_CONVERSION_CHECK = 4; |
| 2530 | 2531 |
| 2531 HTypeConversion(this.type, HInstruction input, [this.kind = NO_CHECK]) | 2532 HTypeConversion(this.type, HInstruction input, [this.kind = NO_CHECK]) |
| 2532 : super(<HInstruction>[input]) { | 2533 : super(<HInstruction>[input]) { |
| 2533 sourceElement = input.sourceElement; | 2534 sourceElement = input.sourceElement; |
| 2534 } | 2535 } |
| 2535 HTypeConversion.checkedModeCheck(HType type, HInstruction input) | 2536 HTypeConversion.checkedModeCheck(HType type, HInstruction input) |
| 2536 : this(type, input, CHECKED_MODE_CHECK); | 2537 : this(type, input, CHECKED_MODE_CHECK); |
| 2537 HTypeConversion.argumentTypeCheck(HType type, HInstruction input) | 2538 HTypeConversion.argumentTypeCheck(HType type, HInstruction input) |
| 2538 : this(type, input, ARGUMENT_TYPE_CHECK); | 2539 : this(type, input, ARGUMENT_TYPE_CHECK); |
| 2539 HTypeConversion.castCheck(HType type, HInstruction input) | 2540 HTypeConversion.castCheck(HType type, HInstruction input) |
| 2540 : this(type, input, CAST_TYPE_CHECK); | 2541 : this(type, input, CAST_TYPE_CHECK); |
| 2541 | 2542 |
| 2542 | 2543 |
| 2543 bool get isChecked => kind != NO_CHECK; | 2544 bool get isChecked => kind != NO_CHECK; |
| 2544 bool get isCheckedModeCheck => kind == CHECKED_MODE_CHECK; | 2545 bool get isCheckedModeCheck { |
| 2546 return kind == CHECKED_MODE_CHECK || kind == BOOLEAN_CONVERSION_CHECK; |
| 2547 } |
| 2545 bool get isArgumentTypeCheck => kind == ARGUMENT_TYPE_CHECK; | 2548 bool get isArgumentTypeCheck => kind == ARGUMENT_TYPE_CHECK; |
| 2546 bool get isCastTypeCheck => kind == CAST_TYPE_CHECK; | 2549 bool get isCastTypeCheck => kind == CAST_TYPE_CHECK; |
| 2550 bool get isBooleanConversionCheck => kind == BOOLEAN_CONVERSION_CHECK; |
| 2547 | 2551 |
| 2548 HType get guaranteedType => type; | 2552 HType get guaranteedType => type; |
| 2549 | 2553 |
| 2550 accept(HVisitor visitor) => visitor.visitTypeConversion(this); | 2554 accept(HVisitor visitor) => visitor.visitTypeConversion(this); |
| 2551 | 2555 |
| 2552 bool isJsStatement(HTypeMap types) => kind == ARGUMENT_TYPE_CHECK; | 2556 bool isJsStatement(HTypeMap types) => kind == ARGUMENT_TYPE_CHECK; |
| 2553 bool isControlFlow() => kind == ARGUMENT_TYPE_CHECK; | 2557 bool isControlFlow() => kind == ARGUMENT_TYPE_CHECK; |
| 2554 | 2558 |
| 2555 int typeCode() => HInstruction.TYPE_CONVERSION_TYPECODE; | 2559 int typeCode() => HInstruction.TYPE_CONVERSION_TYPECODE; |
| 2556 bool typeEquals(HInstruction other) => other is HTypeConversion; | 2560 bool typeEquals(HInstruction other) => other is HTypeConversion; |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2897 HBasicBlock get start => expression.start; | 2901 HBasicBlock get start => expression.start; |
| 2898 HBasicBlock get end { | 2902 HBasicBlock get end { |
| 2899 // We don't create a switch block if there are no cases. | 2903 // We don't create a switch block if there are no cases. |
| 2900 assert(!statements.isEmpty()); | 2904 assert(!statements.isEmpty()); |
| 2901 return statements.last().end; | 2905 return statements.last().end; |
| 2902 } | 2906 } |
| 2903 | 2907 |
| 2904 bool accept(HStatementInformationVisitor visitor) => | 2908 bool accept(HStatementInformationVisitor visitor) => |
| 2905 visitor.visitSwitchInfo(this); | 2909 visitor.visitSwitchInfo(this); |
| 2906 } | 2910 } |
| OLD | NEW |