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 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 visitBitAnd(HBitAnd node); | 9 R visitBitAnd(HBitAnd node); |
10 R visitBitNot(HBitNot node); | 10 R visitBitNot(HBitNot node); |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 return !instructionType.isNullable | 906 return !instructionType.isNullable |
907 && instructionType.satisfies(backend.jsUInt32Class, compiler); | 907 && instructionType.satisfies(backend.jsUInt32Class, compiler); |
908 } | 908 } |
909 | 909 |
910 bool isUInt31(Compiler compiler) { | 910 bool isUInt31(Compiler compiler) { |
911 JavaScriptBackend backend = compiler.backend; | 911 JavaScriptBackend backend = compiler.backend; |
912 return !instructionType.isNullable | 912 return !instructionType.isNullable |
913 && instructionType.satisfies(backend.jsUInt31Class, compiler); | 913 && instructionType.satisfies(backend.jsUInt31Class, compiler); |
914 } | 914 } |
915 | 915 |
| 916 bool isPositiveInteger(Compiler compiler) { |
| 917 JavaScriptBackend backend = compiler.backend; |
| 918 return !instructionType.isNullable |
| 919 && instructionType.satisfies(backend.jsPositiveIntClass, compiler); |
| 920 } |
| 921 |
| 922 bool isPositiveIntegerOrNull(Compiler compiler) { |
| 923 JavaScriptBackend backend = compiler.backend; |
| 924 return instructionType.satisfies(backend.jsPositiveIntClass, compiler); |
| 925 } |
| 926 |
916 bool isIntegerOrNull(Compiler compiler) { | 927 bool isIntegerOrNull(Compiler compiler) { |
917 return instructionType.containsOnlyInt(compiler); | 928 return instructionType.containsOnlyInt(compiler); |
918 } | 929 } |
919 | 930 |
920 bool isNumber(Compiler compiler) { | 931 bool isNumber(Compiler compiler) { |
921 return instructionType.containsOnlyNum(compiler) | 932 return instructionType.containsOnlyNum(compiler) |
922 && !instructionType.isNullable; | 933 && !instructionType.isNullable; |
923 } | 934 } |
924 | 935 |
925 bool isNumberOrNull(Compiler compiler) { | 936 bool isNumberOrNull(Compiler compiler) { |
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2830 HBasicBlock get start => expression.start; | 2841 HBasicBlock get start => expression.start; |
2831 HBasicBlock get end { | 2842 HBasicBlock get end { |
2832 // We don't create a switch block if there are no cases. | 2843 // We don't create a switch block if there are no cases. |
2833 assert(!statements.isEmpty); | 2844 assert(!statements.isEmpty); |
2834 return statements.last.end; | 2845 return statements.last.end; |
2835 } | 2846 } |
2836 | 2847 |
2837 bool accept(HStatementInformationVisitor visitor) => | 2848 bool accept(HStatementInformationVisitor visitor) => |
2838 visitor.visitSwitchInfo(this); | 2849 visitor.visitSwitchInfo(this); |
2839 } | 2850 } |
OLD | NEW |