| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 intptr_t FlowGraphCompiler::ElementSizeFor(intptr_t cid) { | 946 intptr_t FlowGraphCompiler::ElementSizeFor(intptr_t cid) { |
| 947 if (RawObject::IsExternalTypedDataClassId(cid)) { | 947 if (RawObject::IsExternalTypedDataClassId(cid)) { |
| 948 return ExternalTypedData::ElementSizeInBytes(cid); | 948 return ExternalTypedData::ElementSizeInBytes(cid); |
| 949 } else if (RawObject::IsTypedDataClassId(cid)) { | 949 } else if (RawObject::IsTypedDataClassId(cid)) { |
| 950 return TypedData::ElementSizeInBytes(cid); | 950 return TypedData::ElementSizeInBytes(cid); |
| 951 } | 951 } |
| 952 switch (cid) { | 952 switch (cid) { |
| 953 case kArrayCid: | 953 case kArrayCid: |
| 954 case kImmutableArrayCid: | 954 case kImmutableArrayCid: |
| 955 return Array::kBytesPerElement; | 955 return Array::kBytesPerElement; |
| 956 case kFloat32ArrayCid: | |
| 957 return Float32Array::kBytesPerElement; | |
| 958 case kFloat64ArrayCid: | |
| 959 return Float64Array::kBytesPerElement; | |
| 960 case kInt8ArrayCid: | |
| 961 return Int8Array::kBytesPerElement; | |
| 962 case kUint8ArrayCid: | |
| 963 return Uint8Array::kBytesPerElement; | |
| 964 case kUint8ClampedArrayCid: | |
| 965 return Uint8ClampedArray::kBytesPerElement; | |
| 966 case kInt16ArrayCid: | |
| 967 return Int16Array::kBytesPerElement; | |
| 968 case kUint16ArrayCid: | |
| 969 return Uint16Array::kBytesPerElement; | |
| 970 case kInt32ArrayCid: | |
| 971 return Int32Array::kBytesPerElement; | |
| 972 case kUint32ArrayCid: | |
| 973 return Uint32Array::kBytesPerElement; | |
| 974 case kOneByteStringCid: | 956 case kOneByteStringCid: |
| 975 return OneByteString::kBytesPerElement; | 957 return OneByteString::kBytesPerElement; |
| 976 case kTwoByteStringCid: | 958 case kTwoByteStringCid: |
| 977 return TwoByteString::kBytesPerElement; | 959 return TwoByteString::kBytesPerElement; |
| 978 case kExternalUint8ArrayCid: | |
| 979 return ExternalUint8Array::kBytesPerElement; | |
| 980 case kExternalUint8ClampedArrayCid: | |
| 981 return ExternalUint8ClampedArray::kBytesPerElement; | |
| 982 default: | 960 default: |
| 983 UNIMPLEMENTED(); | 961 UNIMPLEMENTED(); |
| 984 return 0; | 962 return 0; |
| 985 } | 963 } |
| 986 } | 964 } |
| 987 | 965 |
| 988 | 966 |
| 989 intptr_t FlowGraphCompiler::DataOffsetFor(intptr_t cid) { | 967 intptr_t FlowGraphCompiler::DataOffsetFor(intptr_t cid) { |
| 990 if (RawObject::IsExternalTypedDataClassId(cid)) { | 968 if (RawObject::IsExternalTypedDataClassId(cid)) { |
| 991 // Elements start at offset 0 of the external data. | 969 // Elements start at offset 0 of the external data. |
| 992 return 0; | 970 return 0; |
| 993 } | 971 } |
| 994 if (RawObject::IsTypedDataClassId(cid)) { | 972 if (RawObject::IsTypedDataClassId(cid)) { |
| 995 return TypedData::data_offset(); | 973 return TypedData::data_offset(); |
| 996 } | 974 } |
| 997 switch (cid) { | 975 switch (cid) { |
| 998 case kArrayCid: | 976 case kArrayCid: |
| 999 case kImmutableArrayCid: | 977 case kImmutableArrayCid: |
| 1000 return Array::data_offset(); | 978 return Array::data_offset(); |
| 1001 case kFloat32ArrayCid: | |
| 1002 return Float32Array::data_offset(); | |
| 1003 case kFloat64ArrayCid: | |
| 1004 return Float64Array::data_offset(); | |
| 1005 case kInt8ArrayCid: | |
| 1006 return Int8Array::data_offset(); | |
| 1007 case kUint8ArrayCid: | |
| 1008 return Uint8Array::data_offset(); | |
| 1009 case kUint8ClampedArrayCid: | |
| 1010 return Uint8ClampedArray::data_offset(); | |
| 1011 case kInt16ArrayCid: | |
| 1012 return Int16Array::data_offset(); | |
| 1013 case kUint16ArrayCid: | |
| 1014 return Uint16Array::data_offset(); | |
| 1015 case kInt32ArrayCid: | |
| 1016 return Int32Array::data_offset(); | |
| 1017 case kUint32ArrayCid: | |
| 1018 return Uint32Array::data_offset(); | |
| 1019 case kOneByteStringCid: | 979 case kOneByteStringCid: |
| 1020 return OneByteString::data_offset(); | 980 return OneByteString::data_offset(); |
| 1021 case kTwoByteStringCid: | 981 case kTwoByteStringCid: |
| 1022 return TwoByteString::data_offset(); | 982 return TwoByteString::data_offset(); |
| 1023 case kExternalUint8ArrayCid: | |
| 1024 case kExternalUint8ClampedArrayCid: | |
| 1025 // Elements start at offset 0 of the external data. | |
| 1026 return 0; | |
| 1027 default: | 983 default: |
| 1028 UNIMPLEMENTED(); | 984 UNIMPLEMENTED(); |
| 1029 return Array::data_offset(); | 985 return Array::data_offset(); |
| 1030 } | 986 } |
| 1031 } | 987 } |
| 1032 | 988 |
| 1033 | 989 |
| 1034 // Returns true if checking against this type is a direct class id comparison. | 990 // Returns true if checking against this type is a direct class id comparison. |
| 1035 bool FlowGraphCompiler::TypeCheckAsClassEquality(const AbstractType& type) { | 991 bool FlowGraphCompiler::TypeCheckAsClassEquality(const AbstractType& type) { |
| 1036 ASSERT(type.IsFinalized() && !type.IsMalformed()); | 992 ASSERT(type.IsFinalized() && !type.IsMalformed()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 if (i != largest_ix) { | 1036 if (i != largest_ix) { |
| 1081 // Swap. | 1037 // Swap. |
| 1082 CidTarget temp = (*sorted)[i]; | 1038 CidTarget temp = (*sorted)[i]; |
| 1083 (*sorted)[i] = (*sorted)[largest_ix]; | 1039 (*sorted)[i] = (*sorted)[largest_ix]; |
| 1084 (*sorted)[largest_ix] = temp; | 1040 (*sorted)[largest_ix] = temp; |
| 1085 } | 1041 } |
| 1086 } | 1042 } |
| 1087 } | 1043 } |
| 1088 | 1044 |
| 1089 } // namespace dart | 1045 } // namespace dart |
| OLD | NEW |