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 visitAwait(HAwait node); | 9 R visitAwait(HAwait node); |
10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 ClassWorld classWorld = compiler.world; | 893 ClassWorld classWorld = compiler.world; |
894 JavaScriptBackend backend = compiler.backend; | 894 JavaScriptBackend backend = compiler.backend; |
895 return instructionType.contains(backend.jsBoolClass, classWorld); | 895 return instructionType.contains(backend.jsBoolClass, classWorld); |
896 } | 896 } |
897 | 897 |
898 bool canBePrimitiveArray(Compiler compiler) { | 898 bool canBePrimitiveArray(Compiler compiler) { |
899 ClassWorld classWorld = compiler.world; | 899 ClassWorld classWorld = compiler.world; |
900 JavaScriptBackend backend = compiler.backend; | 900 JavaScriptBackend backend = compiler.backend; |
901 return instructionType.contains(backend.jsArrayClass, classWorld) | 901 return instructionType.contains(backend.jsArrayClass, classWorld) |
902 || instructionType.contains(backend.jsFixedArrayClass, classWorld) | 902 || instructionType.contains(backend.jsFixedArrayClass, classWorld) |
903 || instructionType.contains(backend.jsExtendableArrayClass, classWorld); | 903 || instructionType.contains(backend.jsExtendableArrayClass, classWorld) |
| 904 || instructionType.contains( |
| 905 backend.jsUnmodifiableArrayClass, classWorld); |
904 } | 906 } |
905 | 907 |
906 bool isIndexablePrimitive(Compiler compiler) { | 908 bool isIndexablePrimitive(Compiler compiler) { |
907 ClassWorld classWorld = compiler.world; | 909 ClassWorld classWorld = compiler.world; |
908 JavaScriptBackend backend = compiler.backend; | 910 JavaScriptBackend backend = compiler.backend; |
909 return instructionType.containsOnlyString(classWorld) | 911 return instructionType.containsOnlyString(classWorld) |
910 || instructionType.satisfies(backend.jsIndexableClass, classWorld); | 912 || instructionType.satisfies(backend.jsIndexableClass, classWorld); |
911 } | 913 } |
912 | 914 |
913 bool isFixedArray(Compiler compiler) { | 915 bool isFixedArray(Compiler compiler) { |
914 JavaScriptBackend backend = compiler.backend; | 916 JavaScriptBackend backend = compiler.backend; |
915 return instructionType.containsOnly(backend.jsFixedArrayClass); | 917 // TODO(sra): Recognize the union of these types as well. |
| 918 return instructionType.containsOnly(backend.jsFixedArrayClass) |
| 919 || instructionType.containsOnly(backend.jsUnmodifiableArrayClass); |
916 } | 920 } |
917 | 921 |
918 bool isExtendableArray(Compiler compiler) { | 922 bool isExtendableArray(Compiler compiler) { |
919 JavaScriptBackend backend = compiler.backend; | 923 JavaScriptBackend backend = compiler.backend; |
920 return instructionType.containsOnly(backend.jsExtendableArrayClass); | 924 return instructionType.containsOnly(backend.jsExtendableArrayClass); |
921 } | 925 } |
922 | 926 |
923 bool isMutableArray(Compiler compiler) { | 927 bool isMutableArray(Compiler compiler) { |
924 ClassWorld classWorld = compiler.world; | 928 ClassWorld classWorld = compiler.world; |
925 JavaScriptBackend backend = compiler.backend; | 929 JavaScriptBackend backend = compiler.backend; |
(...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3177 class HDynamicType extends HRuntimeType { | 3181 class HDynamicType extends HRuntimeType { |
3178 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3182 HDynamicType(DynamicType dartType, TypeMask instructionType) |
3179 : super(const <HInstruction>[], dartType, instructionType); | 3183 : super(const <HInstruction>[], dartType, instructionType); |
3180 | 3184 |
3181 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3185 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
3182 | 3186 |
3183 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3187 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
3184 | 3188 |
3185 bool typeEquals(HInstruction other) => other is HDynamicType; | 3189 bool typeEquals(HInstruction other) => other is HDynamicType; |
3186 } | 3190 } |
OLD | NEW |