OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/opcodes.h" | 5 #include "src/compiler/opcodes.h" |
6 #include "src/compiler/operator.h" | 6 #include "src/compiler/operator.h" |
7 #include "src/compiler/operator-properties.h" | 7 #include "src/compiler/operator-properties.h" |
8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
9 #include "src/types-inl.h" | 9 #include "src/types-inl.h" |
10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 ::testing::ValuesIn(kExternalArrayTypes)); | 193 ::testing::ValuesIn(kExternalArrayTypes)); |
194 | 194 |
195 | 195 |
196 // ----------------------------------------------------------------------------- | 196 // ----------------------------------------------------------------------------- |
197 // Element access operators. | 197 // Element access operators. |
198 | 198 |
199 | 199 |
200 namespace { | 200 namespace { |
201 | 201 |
202 const ElementAccess kElementAccesses[] = { | 202 const ElementAccess kElementAccesses[] = { |
203 {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), kMachAnyTagged}, | 203 {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), |
204 {kUntaggedBase, 0, Type::Any(), kMachInt8}, | 204 MachineType::AnyTagged()}, |
205 {kUntaggedBase, 0, Type::Any(), kMachInt16}, | 205 {kUntaggedBase, 0, Type::Any(), MachineType::Int8()}, |
206 {kUntaggedBase, 0, Type::Any(), kMachInt32}, | 206 {kUntaggedBase, 0, Type::Any(), MachineType::Int16()}, |
207 {kUntaggedBase, 0, Type::Any(), kMachUint8}, | 207 {kUntaggedBase, 0, Type::Any(), MachineType::Int32()}, |
208 {kUntaggedBase, 0, Type::Any(), kMachUint16}, | 208 {kUntaggedBase, 0, Type::Any(), MachineType::Uint8()}, |
209 {kUntaggedBase, 0, Type::Any(), kMachUint32}, | 209 {kUntaggedBase, 0, Type::Any(), MachineType::Uint16()}, |
210 {kUntaggedBase, 0, Type::Signed32(), kMachInt8}, | 210 {kUntaggedBase, 0, Type::Any(), MachineType::Uint32()}, |
211 {kUntaggedBase, 0, Type::Unsigned32(), kMachUint8}, | 211 {kUntaggedBase, 0, Type::Signed32(), MachineType::Int8()}, |
212 {kUntaggedBase, 0, Type::Signed32(), kMachInt16}, | 212 {kUntaggedBase, 0, Type::Unsigned32(), MachineType::Uint8()}, |
213 {kUntaggedBase, 0, Type::Unsigned32(), kMachUint16}, | 213 {kUntaggedBase, 0, Type::Signed32(), MachineType::Int16()}, |
214 {kUntaggedBase, 0, Type::Signed32(), kMachInt32}, | 214 {kUntaggedBase, 0, Type::Unsigned32(), MachineType::Uint16()}, |
215 {kUntaggedBase, 0, Type::Unsigned32(), kMachUint32}, | 215 {kUntaggedBase, 0, Type::Signed32(), MachineType::Int32()}, |
216 {kUntaggedBase, 0, Type::Number(), kRepFloat32}, | 216 {kUntaggedBase, 0, Type::Unsigned32(), MachineType::Uint32()}, |
217 {kUntaggedBase, 0, Type::Number(), kRepFloat64}, | 217 {kUntaggedBase, 0, Type::Number(), |
| 218 MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone)}, |
| 219 {kUntaggedBase, 0, Type::Number(), |
| 220 MachineType(MachineRepresentation::kFloat64, MachineSemantic::kNone)}, |
218 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(), | 221 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(), |
219 kMachInt8}, | 222 MachineType::Int8()}, |
220 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(), | 223 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(), |
221 kMachUint8}, | 224 MachineType::Uint8()}, |
222 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(), | 225 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(), |
223 kMachInt16}, | 226 MachineType::Int16()}, |
224 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(), | 227 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(), |
225 kMachUint16}, | 228 MachineType::Uint16()}, |
226 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(), | 229 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(), |
227 kMachInt32}, | 230 MachineType::Int32()}, |
228 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(), | 231 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(), |
229 kMachUint32}, | 232 MachineType::Uint32()}, |
230 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Number(), | 233 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Number(), |
231 kRepFloat32}, | 234 MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone)}, |
232 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Number(), | 235 {kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Number(), |
233 kRepFloat64}}; | 236 MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone)}}; |
234 | 237 |
235 } // namespace | 238 } // namespace |
236 | 239 |
237 | 240 |
238 class SimplifiedElementAccessOperatorTest | 241 class SimplifiedElementAccessOperatorTest |
239 : public TestWithZone, | 242 : public TestWithZone, |
240 public ::testing::WithParamInterface<ElementAccess> {}; | 243 public ::testing::WithParamInterface<ElementAccess> {}; |
241 | 244 |
242 | 245 |
243 TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) { | 246 TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 283 } |
281 | 284 |
282 | 285 |
283 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, | 286 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, |
284 SimplifiedElementAccessOperatorTest, | 287 SimplifiedElementAccessOperatorTest, |
285 ::testing::ValuesIn(kElementAccesses)); | 288 ::testing::ValuesIn(kElementAccesses)); |
286 | 289 |
287 } // namespace compiler | 290 } // namespace compiler |
288 } // namespace internal | 291 } // namespace internal |
289 } // namespace v8 | 292 } // namespace v8 |
OLD | NEW |