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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 | 1124 |
1125 | 1125 |
1126 RawAbstractType* LoadIndexedInstr::CompileType() const { | 1126 RawAbstractType* LoadIndexedInstr::CompileType() const { |
1127 switch (class_id_) { | 1127 switch (class_id_) { |
1128 case kArrayCid: | 1128 case kArrayCid: |
1129 case kImmutableArrayCid: | 1129 case kImmutableArrayCid: |
1130 return Type::DynamicType(); | 1130 return Type::DynamicType(); |
1131 case kFloat32ArrayCid : | 1131 case kFloat32ArrayCid : |
1132 case kFloat64ArrayCid : | 1132 case kFloat64ArrayCid : |
1133 return Type::Double(); | 1133 return Type::Double(); |
| 1134 case kInt8ArrayCid: |
1134 case kUint8ArrayCid: | 1135 case kUint8ArrayCid: |
1135 case kUint8ClampedArrayCid: | 1136 case kUint8ClampedArrayCid: |
1136 case kExternalUint8ArrayCid: | 1137 case kExternalUint8ArrayCid: |
| 1138 case kInt16ArrayCid: |
| 1139 case kUint16ArrayCid: |
1137 return Type::IntType(); | 1140 return Type::IntType(); |
1138 default: | 1141 default: |
1139 UNIMPLEMENTED(); | 1142 UNIMPLEMENTED(); |
1140 return Type::IntType(); | 1143 return Type::IntType(); |
1141 } | 1144 } |
1142 } | 1145 } |
1143 | 1146 |
1144 | 1147 |
1145 intptr_t LoadIndexedInstr::ResultCid() const { | 1148 intptr_t LoadIndexedInstr::ResultCid() const { |
1146 switch (class_id_) { | 1149 switch (class_id_) { |
1147 case kArrayCid: | 1150 case kArrayCid: |
1148 case kImmutableArrayCid: | 1151 case kImmutableArrayCid: |
1149 return kDynamicCid; | 1152 return kDynamicCid; |
1150 case kFloat32ArrayCid : | 1153 case kFloat32ArrayCid : |
1151 case kFloat64ArrayCid : | 1154 case kFloat64ArrayCid : |
1152 return kDoubleCid; | 1155 return kDoubleCid; |
| 1156 case kInt8ArrayCid: |
1153 case kUint8ArrayCid: | 1157 case kUint8ArrayCid: |
1154 case kUint8ClampedArrayCid: | 1158 case kUint8ClampedArrayCid: |
1155 case kExternalUint8ArrayCid: | 1159 case kExternalUint8ArrayCid: |
| 1160 case kInt16ArrayCid: |
| 1161 case kUint16ArrayCid: |
1156 return kSmiCid; | 1162 return kSmiCid; |
1157 default: | 1163 default: |
1158 UNIMPLEMENTED(); | 1164 UNIMPLEMENTED(); |
1159 return kSmiCid; | 1165 return kSmiCid; |
1160 } | 1166 } |
1161 } | 1167 } |
1162 | 1168 |
1163 | 1169 |
1164 Representation LoadIndexedInstr::representation() const { | 1170 Representation LoadIndexedInstr::representation() const { |
1165 switch (class_id_) { | 1171 switch (class_id_) { |
1166 case kArrayCid: | 1172 case kArrayCid: |
1167 case kImmutableArrayCid: | 1173 case kImmutableArrayCid: |
| 1174 case kInt8ArrayCid: |
1168 case kUint8ArrayCid: | 1175 case kUint8ArrayCid: |
1169 case kUint8ClampedArrayCid: | 1176 case kUint8ClampedArrayCid: |
1170 case kExternalUint8ArrayCid: | 1177 case kExternalUint8ArrayCid: |
| 1178 case kInt16ArrayCid: |
| 1179 case kUint16ArrayCid: |
1171 return kTagged; | 1180 return kTagged; |
1172 case kFloat32ArrayCid : | 1181 case kFloat32ArrayCid : |
1173 case kFloat64ArrayCid : | 1182 case kFloat64ArrayCid : |
1174 return kUnboxedDouble; | 1183 return kUnboxedDouble; |
1175 default: | 1184 default: |
1176 UNIMPLEMENTED(); | 1185 UNIMPLEMENTED(); |
1177 return kTagged; | 1186 return kTagged; |
1178 } | 1187 } |
1179 } | 1188 } |
1180 | 1189 |
1181 | 1190 |
1182 RawAbstractType* StoreIndexedInstr::CompileType() const { | 1191 RawAbstractType* StoreIndexedInstr::CompileType() const { |
1183 return AbstractType::null(); | 1192 return AbstractType::null(); |
1184 } | 1193 } |
1185 | 1194 |
1186 | 1195 |
1187 Representation StoreIndexedInstr::RequiredInputRepresentation( | 1196 Representation StoreIndexedInstr::RequiredInputRepresentation( |
1188 intptr_t idx) const { | 1197 intptr_t idx) const { |
1189 if ((idx == 0) || (idx == 1)) return kTagged; | 1198 if ((idx == 0) || (idx == 1)) return kTagged; |
1190 ASSERT(idx == 2); | 1199 ASSERT(idx == 2); |
1191 switch (class_id_) { | 1200 switch (class_id_) { |
1192 case kArrayCid: | 1201 case kArrayCid: |
| 1202 case kInt8ArrayCid: |
1193 case kUint8ArrayCid: | 1203 case kUint8ArrayCid: |
| 1204 case kUint8ClampedArrayCid: |
| 1205 case kInt16ArrayCid: |
| 1206 case kUint16ArrayCid: |
1194 return kTagged; | 1207 return kTagged; |
1195 case kFloat32ArrayCid : | 1208 case kFloat32ArrayCid : |
1196 case kFloat64ArrayCid : | 1209 case kFloat64ArrayCid : |
1197 return kUnboxedDouble; | 1210 return kUnboxedDouble; |
1198 default: | 1211 default: |
1199 UNIMPLEMENTED(); | 1212 UNIMPLEMENTED(); |
1200 return kTagged; | 1213 return kTagged; |
1201 } | 1214 } |
1202 } | 1215 } |
1203 | 1216 |
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2698 RangeBoundary::FromConstant(0xFFFF)); | 2711 RangeBoundary::FromConstant(0xFFFF)); |
2699 break; | 2712 break; |
2700 default: | 2713 default: |
2701 UNIMPLEMENTED(); | 2714 UNIMPLEMENTED(); |
2702 } | 2715 } |
2703 } | 2716 } |
2704 | 2717 |
2705 | 2718 |
2706 void LoadIndexedInstr::InferRange() { | 2719 void LoadIndexedInstr::InferRange() { |
2707 switch (class_id()) { | 2720 switch (class_id()) { |
| 2721 case kInt8ArrayCid: |
| 2722 range_ = new Range(RangeBoundary::FromConstant(-128), |
| 2723 RangeBoundary::FromConstant(127)); |
| 2724 break; |
2708 case kUint8ArrayCid: | 2725 case kUint8ArrayCid: |
2709 case kUint8ClampedArrayCid: | 2726 case kUint8ClampedArrayCid: |
2710 case kExternalUint8ArrayCid: | 2727 case kExternalUint8ArrayCid: |
2711 range_ = new Range(RangeBoundary::FromConstant(0), | 2728 range_ = new Range(RangeBoundary::FromConstant(0), |
2712 RangeBoundary::FromConstant(255)); | 2729 RangeBoundary::FromConstant(255)); |
2713 break; | 2730 break; |
| 2731 case kInt16ArrayCid: |
| 2732 range_ = new Range(RangeBoundary::FromConstant(-32768), |
| 2733 RangeBoundary::FromConstant(32767)); |
| 2734 break; |
| 2735 case kUint16ArrayCid: |
| 2736 range_ = new Range(RangeBoundary::FromConstant(0), |
| 2737 RangeBoundary::FromConstant(65535)); |
| 2738 break; |
2714 default: | 2739 default: |
2715 Definition::InferRange(); | 2740 Definition::InferRange(); |
2716 break; | 2741 break; |
2717 } | 2742 } |
2718 } | 2743 } |
2719 | 2744 |
2720 | 2745 |
2721 void PhiInstr::InferRange() { | 2746 void PhiInstr::InferRange() { |
2722 RangeBoundary new_min; | 2747 RangeBoundary new_min; |
2723 RangeBoundary new_max; | 2748 RangeBoundary new_max; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2977 default: | 3002 default: |
2978 UNREACHABLE(); | 3003 UNREACHABLE(); |
2979 return -1; | 3004 return -1; |
2980 } | 3005 } |
2981 } | 3006 } |
2982 | 3007 |
2983 | 3008 |
2984 #undef __ | 3009 #undef __ |
2985 | 3010 |
2986 } // namespace dart | 3011 } // namespace dart |
OLD | NEW |