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/machine-operator.h" | 5 #include "src/compiler/machine-operator.h" |
6 #include "src/compiler/opcodes.h" | 6 #include "src/compiler/opcodes.h" |
7 #include "src/compiler/operator.h" | 7 #include "src/compiler/operator.h" |
8 #include "src/compiler/operator-properties.h" | 8 #include "src/compiler/operator-properties.h" |
9 #include "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 private: | 25 private: |
26 typedef ::testing::WithParamInterface< ::testing::tuple<MachineType, T> > B; | 26 typedef ::testing::WithParamInterface< ::testing::tuple<MachineType, T> > B; |
27 }; | 27 }; |
28 | 28 |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 const MachineType kMachineReps[] = {kRepWord32, kRepWord64}; | 32 const MachineType kMachineReps[] = {kRepWord32, kRepWord64}; |
33 | 33 |
34 | 34 |
35 const MachineType kMachineTypes[] = { | 35 const MachineType kMachineTypesForAccess[] = { |
36 kMachFloat32, kMachFloat64, kMachInt8, kMachUint8, kMachInt16, | 36 kMachFloat32, kMachFloat64, kMachInt8, kMachUint8, kMachInt16, |
37 kMachUint16, kMachInt32, kMachUint32, kMachInt64, kMachUint64, | 37 kMachUint16, kMachInt32, kMachUint32, kMachInt64, kMachUint64, |
38 kMachPtr, kMachAnyTagged, kRepBit, kRepWord8, kRepWord16, | 38 kMachPtr, kMachAnyTagged, kMachPtr}; |
39 kRepWord32, kRepWord64, kRepFloat32, kRepFloat64, kRepTagged}; | |
40 | 39 |
41 } // namespace | 40 } // namespace |
42 | 41 |
43 | 42 |
44 // ----------------------------------------------------------------------------- | 43 // ----------------------------------------------------------------------------- |
45 // Load operator. | 44 // Load operator. |
46 | 45 |
47 | 46 |
48 typedef MachineOperatorTestWithParam<LoadRepresentation> | 47 typedef MachineOperatorTestWithParam<LoadRepresentation> |
49 MachineLoadOperatorTest; | 48 MachineLoadOperatorTest; |
(...skipping 27 matching lines...) Expand all Loading... |
77 } | 76 } |
78 | 77 |
79 | 78 |
80 TEST_P(MachineLoadOperatorTest, ParameterIsCorrect) { | 79 TEST_P(MachineLoadOperatorTest, ParameterIsCorrect) { |
81 MachineOperatorBuilder machine(zone(), type()); | 80 MachineOperatorBuilder machine(zone(), type()); |
82 EXPECT_EQ(GetParam(), | 81 EXPECT_EQ(GetParam(), |
83 OpParameter<LoadRepresentation>(machine.Load(GetParam()))); | 82 OpParameter<LoadRepresentation>(machine.Load(GetParam()))); |
84 } | 83 } |
85 | 84 |
86 | 85 |
87 INSTANTIATE_TEST_CASE_P(MachineOperatorTest, MachineLoadOperatorTest, | 86 INSTANTIATE_TEST_CASE_P( |
88 ::testing::Combine(::testing::ValuesIn(kMachineReps), | 87 MachineOperatorTest, MachineLoadOperatorTest, |
89 ::testing::ValuesIn(kMachineTypes))); | 88 ::testing::Combine(::testing::ValuesIn(kMachineReps), |
| 89 ::testing::ValuesIn(kMachineTypesForAccess))); |
90 | 90 |
91 | 91 |
92 // ----------------------------------------------------------------------------- | 92 // ----------------------------------------------------------------------------- |
93 // Store operator. | 93 // Store operator. |
94 | 94 |
95 | 95 |
96 class MachineStoreOperatorTest | 96 class MachineStoreOperatorTest |
97 : public MachineOperatorTestWithParam< | 97 : public MachineOperatorTestWithParam< |
98 ::testing::tuple<MachineType, WriteBarrierKind> > { | 98 ::testing::tuple<MachineType, WriteBarrierKind> > { |
99 protected: | 99 protected: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 MachineOperatorBuilder machine(zone(), type()); | 139 MachineOperatorBuilder machine(zone(), type()); |
140 EXPECT_EQ(GetParam(), | 140 EXPECT_EQ(GetParam(), |
141 OpParameter<StoreRepresentation>(machine.Store(GetParam()))); | 141 OpParameter<StoreRepresentation>(machine.Store(GetParam()))); |
142 } | 142 } |
143 | 143 |
144 | 144 |
145 INSTANTIATE_TEST_CASE_P( | 145 INSTANTIATE_TEST_CASE_P( |
146 MachineOperatorTest, MachineStoreOperatorTest, | 146 MachineOperatorTest, MachineStoreOperatorTest, |
147 ::testing::Combine( | 147 ::testing::Combine( |
148 ::testing::ValuesIn(kMachineReps), | 148 ::testing::ValuesIn(kMachineReps), |
149 ::testing::Combine(::testing::ValuesIn(kMachineTypes), | 149 ::testing::Combine(::testing::ValuesIn(kMachineTypesForAccess), |
150 ::testing::Values(kNoWriteBarrier, | 150 ::testing::Values(kNoWriteBarrier, |
151 kFullWriteBarrier)))); | 151 kFullWriteBarrier)))); |
152 #endif | 152 #endif |
153 | 153 |
154 // ----------------------------------------------------------------------------- | 154 // ----------------------------------------------------------------------------- |
155 // Pure operators. | 155 // Pure operators. |
156 | 156 |
157 namespace { | 157 namespace { |
158 | 158 |
159 struct PureOperator { | 159 struct PureOperator { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 EXPECT_EQ(machine.Uint64Div(), machine.UintDiv()); | 394 EXPECT_EQ(machine.Uint64Div(), machine.UintDiv()); |
395 EXPECT_EQ(machine.Int64Mod(), machine.IntMod()); | 395 EXPECT_EQ(machine.Int64Mod(), machine.IntMod()); |
396 EXPECT_EQ(machine.Uint64Mod(), machine.UintMod()); | 396 EXPECT_EQ(machine.Uint64Mod(), machine.UintMod()); |
397 EXPECT_EQ(machine.Int64LessThan(), machine.IntLessThan()); | 397 EXPECT_EQ(machine.Int64LessThan(), machine.IntLessThan()); |
398 EXPECT_EQ(machine.Int64LessThanOrEqual(), machine.IntLessThanOrEqual()); | 398 EXPECT_EQ(machine.Int64LessThanOrEqual(), machine.IntLessThanOrEqual()); |
399 } | 399 } |
400 | 400 |
401 } // namespace compiler | 401 } // namespace compiler |
402 } // namespace internal | 402 } // namespace internal |
403 } // namespace v8 | 403 } // namespace v8 |
OLD | NEW |