| 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 #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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 const intptr_t disp = | 1017 const intptr_t disp = |
| 1018 offset * kDoubleSize + Float64Array::data_offset(); | 1018 offset * kDoubleSize + Float64Array::data_offset(); |
| 1019 ASSERT(Utils::IsInt(31, disp)); | 1019 ASSERT(Utils::IsInt(31, disp)); |
| 1020 return FieldAddress(array, disp); | 1020 return FieldAddress(array, disp); |
| 1021 } | 1021 } |
| 1022 case kUint8ArrayCid: { | 1022 case kUint8ArrayCid: { |
| 1023 const intptr_t disp = offset + Uint8Array::data_offset(); | 1023 const intptr_t disp = offset + Uint8Array::data_offset(); |
| 1024 ASSERT(Utils::IsInt(31, disp)); | 1024 ASSERT(Utils::IsInt(31, disp)); |
| 1025 return FieldAddress(array, disp); | 1025 return FieldAddress(array, disp); |
| 1026 } | 1026 } |
| 1027 case kUint8ClampedArrayCid: { |
| 1028 const intptr_t disp = offset + Uint8ClampedArray::data_offset(); |
| 1029 ASSERT(Utils::IsInt(31, disp)); |
| 1030 return FieldAddress(array, disp); |
| 1031 } |
| 1027 default: | 1032 default: |
| 1028 UNIMPLEMENTED(); | 1033 UNIMPLEMENTED(); |
| 1029 return FieldAddress(SPREG, 0); | 1034 return FieldAddress(SPREG, 0); |
| 1030 } | 1035 } |
| 1031 } | 1036 } |
| 1032 | 1037 |
| 1033 | 1038 |
| 1034 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, | 1039 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, |
| 1035 Register array, | 1040 Register array, |
| 1036 Register index) { | 1041 Register index) { |
| 1037 // Note that index is Smi, i.e, times 2. | 1042 // Note that index is Smi, i.e, times 2. |
| 1038 ASSERT(kSmiTagShift == 1); | 1043 ASSERT(kSmiTagShift == 1); |
| 1039 switch (cid) { | 1044 switch (cid) { |
| 1040 case kArrayCid: | 1045 case kArrayCid: |
| 1041 case kImmutableArrayCid: | 1046 case kImmutableArrayCid: |
| 1042 return FieldAddress(array, index, TIMES_HALF_WORD_SIZE, sizeof(RawArray)); | 1047 return FieldAddress(array, index, TIMES_HALF_WORD_SIZE, sizeof(RawArray)); |
| 1043 case kFloat32ArrayCid: | 1048 case kFloat32ArrayCid: |
| 1044 return FieldAddress(array, index, TIMES_2, Float32Array::data_offset()); | 1049 return FieldAddress(array, index, TIMES_2, Float32Array::data_offset()); |
| 1045 case kFloat64ArrayCid: | 1050 case kFloat64ArrayCid: |
| 1046 return FieldAddress(array, index, TIMES_4, Float64Array::data_offset()); | 1051 return FieldAddress(array, index, TIMES_4, Float64Array::data_offset()); |
| 1047 case kUint8ArrayCid: | 1052 case kUint8ArrayCid: |
| 1048 return FieldAddress(array, index, TIMES_1, Uint8Array::data_offset()); | 1053 return FieldAddress(array, index, TIMES_1, Uint8Array::data_offset()); |
| 1054 case kUint8ClampedArrayCid: |
| 1055 return |
| 1056 FieldAddress(array, index, TIMES_1, Uint8ClampedArray::data_offset()); |
| 1049 default: | 1057 default: |
| 1050 UNIMPLEMENTED(); | 1058 UNIMPLEMENTED(); |
| 1051 return FieldAddress(SPREG, 0); | 1059 return FieldAddress(SPREG, 0); |
| 1052 } | 1060 } |
| 1053 } | 1061 } |
| 1054 | 1062 |
| 1055 | 1063 |
| 1056 // Returns true if checking against this type is a direct class id comparison. | 1064 // Returns true if checking against this type is a direct class id comparison. |
| 1057 bool FlowGraphCompiler::TypeCheckAsClassEquality(const AbstractType& type) { | 1065 bool FlowGraphCompiler::TypeCheckAsClassEquality(const AbstractType& type) { |
| 1058 ASSERT(type.IsFinalized() && !type.IsMalformed()); | 1066 ASSERT(type.IsFinalized() && !type.IsMalformed()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1072 const AbstractTypeArguments& type_arguments = | 1080 const AbstractTypeArguments& type_arguments = |
| 1073 AbstractTypeArguments::Handle(type.arguments()); | 1081 AbstractTypeArguments::Handle(type.arguments()); |
| 1074 const bool is_raw_type = type_arguments.IsNull() || | 1082 const bool is_raw_type = type_arguments.IsNull() || |
| 1075 type_arguments.IsRaw(type_arguments.Length()); | 1083 type_arguments.IsRaw(type_arguments.Length()); |
| 1076 return is_raw_type; | 1084 return is_raw_type; |
| 1077 } | 1085 } |
| 1078 return true; | 1086 return true; |
| 1079 } | 1087 } |
| 1080 | 1088 |
| 1081 } // namespace dart | 1089 } // namespace dart |
| OLD | NEW |