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 25 matching lines...) Expand all Loading... |
36 const MachineRepresentation kMachineReps[] = {MachineRepresentation::kWord32, | 36 const MachineRepresentation kMachineReps[] = {MachineRepresentation::kWord32, |
37 MachineRepresentation::kWord64}; | 37 MachineRepresentation::kWord64}; |
38 | 38 |
39 | 39 |
40 const MachineType kMachineTypesForAccess[] = { | 40 const MachineType kMachineTypesForAccess[] = { |
41 MachineType::Float32(), MachineType::Float64(), MachineType::Int8(), | 41 MachineType::Float32(), MachineType::Float64(), MachineType::Int8(), |
42 MachineType::Uint8(), MachineType::Int16(), MachineType::Uint16(), | 42 MachineType::Uint8(), MachineType::Int16(), MachineType::Uint16(), |
43 MachineType::Int32(), MachineType::Uint32(), MachineType::Int64(), | 43 MachineType::Int32(), MachineType::Uint32(), MachineType::Int64(), |
44 MachineType::Uint64(), MachineType::AnyTagged()}; | 44 MachineType::Uint64(), MachineType::AnyTagged()}; |
45 | 45 |
| 46 |
| 47 const MachineRepresentation kRepresentationsForStore[] = { |
| 48 MachineRepresentation::kFloat32, MachineRepresentation::kFloat64, |
| 49 MachineRepresentation::kWord8, MachineRepresentation::kWord16, |
| 50 MachineRepresentation::kWord32, MachineRepresentation::kWord64, |
| 51 MachineRepresentation::kTagged}; |
| 52 |
46 } // namespace | 53 } // namespace |
47 | 54 |
48 | 55 |
49 // ----------------------------------------------------------------------------- | 56 // ----------------------------------------------------------------------------- |
50 // Load operator. | 57 // Load operator. |
51 | 58 |
52 | 59 |
53 typedef MachineOperatorTestWithParam<LoadRepresentation> | 60 typedef MachineOperatorTestWithParam<LoadRepresentation> |
54 MachineLoadOperatorTest; | 61 MachineLoadOperatorTest; |
55 | 62 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 ::testing::Combine(::testing::ValuesIn(kMachineReps), | 101 ::testing::Combine(::testing::ValuesIn(kMachineReps), |
95 ::testing::ValuesIn(kMachineTypesForAccess))); | 102 ::testing::ValuesIn(kMachineTypesForAccess))); |
96 | 103 |
97 | 104 |
98 // ----------------------------------------------------------------------------- | 105 // ----------------------------------------------------------------------------- |
99 // Store operator. | 106 // Store operator. |
100 | 107 |
101 | 108 |
102 class MachineStoreOperatorTest | 109 class MachineStoreOperatorTest |
103 : public MachineOperatorTestWithParam< | 110 : public MachineOperatorTestWithParam< |
104 ::testing::tuple<MachineType, WriteBarrierKind> > { | 111 ::testing::tuple<MachineRepresentation, WriteBarrierKind> > { |
105 protected: | 112 protected: |
106 StoreRepresentation GetParam() const { | 113 StoreRepresentation GetParam() const { |
107 return StoreRepresentation( | 114 return StoreRepresentation( |
108 ::testing::get<0>(MachineOperatorTestWithParam< | 115 ::testing::get<0>( |
109 ::testing::tuple<MachineType, WriteBarrierKind> >::GetParam()), | 116 MachineOperatorTestWithParam< ::testing::tuple< |
110 ::testing::get<1>(MachineOperatorTestWithParam< | 117 MachineRepresentation, WriteBarrierKind> >::GetParam()), |
111 ::testing::tuple<MachineType, WriteBarrierKind> >::GetParam())); | 118 ::testing::get<1>( |
| 119 MachineOperatorTestWithParam< ::testing::tuple< |
| 120 MachineRepresentation, WriteBarrierKind> >::GetParam())); |
112 } | 121 } |
113 }; | 122 }; |
114 | 123 |
115 | 124 |
116 TEST_P(MachineStoreOperatorTest, InstancesAreGloballyShared) { | 125 TEST_P(MachineStoreOperatorTest, InstancesAreGloballyShared) { |
117 MachineOperatorBuilder machine1(zone(), representation()); | 126 MachineOperatorBuilder machine1(zone(), representation()); |
118 MachineOperatorBuilder machine2(zone(), representation()); | 127 MachineOperatorBuilder machine2(zone(), representation()); |
119 EXPECT_EQ(machine1.Store(GetParam()), machine2.Store(GetParam())); | 128 EXPECT_EQ(machine1.Store(GetParam()), machine2.Store(GetParam())); |
120 } | 129 } |
121 | 130 |
(...skipping 23 matching lines...) Expand all Loading... |
145 MachineOperatorBuilder machine(zone(), representation()); | 154 MachineOperatorBuilder machine(zone(), representation()); |
146 EXPECT_EQ(GetParam(), | 155 EXPECT_EQ(GetParam(), |
147 OpParameter<StoreRepresentation>(machine.Store(GetParam()))); | 156 OpParameter<StoreRepresentation>(machine.Store(GetParam()))); |
148 } | 157 } |
149 | 158 |
150 | 159 |
151 INSTANTIATE_TEST_CASE_P( | 160 INSTANTIATE_TEST_CASE_P( |
152 MachineOperatorTest, MachineStoreOperatorTest, | 161 MachineOperatorTest, MachineStoreOperatorTest, |
153 ::testing::Combine( | 162 ::testing::Combine( |
154 ::testing::ValuesIn(kMachineReps), | 163 ::testing::ValuesIn(kMachineReps), |
155 ::testing::Combine(::testing::ValuesIn(kMachineTypesForAccess), | 164 ::testing::Combine(::testing::ValuesIn(kRepresentationsForStore), |
156 ::testing::Values(kNoWriteBarrier, | 165 ::testing::Values(kNoWriteBarrier, |
157 kFullWriteBarrier)))); | 166 kFullWriteBarrier)))); |
158 #endif | 167 #endif |
159 | 168 |
160 // ----------------------------------------------------------------------------- | 169 // ----------------------------------------------------------------------------- |
161 // Pure operators. | 170 // Pure operators. |
162 | 171 |
163 namespace { | 172 namespace { |
164 | 173 |
165 struct PureOperator { | 174 struct PureOperator { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 EXPECT_EQ(machine.Uint64Div(), machine.UintDiv()); | 413 EXPECT_EQ(machine.Uint64Div(), machine.UintDiv()); |
405 EXPECT_EQ(machine.Int64Mod(), machine.IntMod()); | 414 EXPECT_EQ(machine.Int64Mod(), machine.IntMod()); |
406 EXPECT_EQ(machine.Uint64Mod(), machine.UintMod()); | 415 EXPECT_EQ(machine.Uint64Mod(), machine.UintMod()); |
407 EXPECT_EQ(machine.Int64LessThan(), machine.IntLessThan()); | 416 EXPECT_EQ(machine.Int64LessThan(), machine.IntLessThan()); |
408 EXPECT_EQ(machine.Int64LessThanOrEqual(), machine.IntLessThanOrEqual()); | 417 EXPECT_EQ(machine.Int64LessThanOrEqual(), machine.IntLessThanOrEqual()); |
409 } | 418 } |
410 | 419 |
411 } // namespace compiler | 420 } // namespace compiler |
412 } // namespace internal | 421 } // namespace internal |
413 } // namespace v8 | 422 } // namespace v8 |
OLD | NEW |