OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/int64-lowering.h" | 5 #include "src/compiler/int64-lowering.h" |
6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 | 10 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 STORE_VERIFY(kStore, kRep32) | 230 STORE_VERIFY(kStore, kRep32) |
231 | 231 |
232 TEST_F(Int64LoweringTest, Int64Store) { | 232 TEST_F(Int64LoweringTest, Int64Store) { |
233 const StoreRepresentation rep64(MachineRepresentation::kWord64, | 233 const StoreRepresentation rep64(MachineRepresentation::kWord64, |
234 WriteBarrierKind::kNoWriteBarrier); | 234 WriteBarrierKind::kNoWriteBarrier); |
235 const StoreRepresentation rep32(MachineRepresentation::kWord32, | 235 const StoreRepresentation rep32(MachineRepresentation::kWord32, |
236 WriteBarrierKind::kNoWriteBarrier); | 236 WriteBarrierKind::kNoWriteBarrier); |
237 INT64_STORE_LOWERING(Store, rep32, rep64); | 237 INT64_STORE_LOWERING(Store, rep32, rep64); |
238 } | 238 } |
239 | 239 |
| 240 TEST_F(Int64LoweringTest, Int32Store) { |
| 241 const StoreRepresentation rep32(MachineRepresentation::kWord32, |
| 242 WriteBarrierKind::kNoWriteBarrier); |
| 243 int32_t base = 1111; |
| 244 int32_t index = 2222; |
| 245 int32_t return_value = 0x5555; |
| 246 |
| 247 Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 0); |
| 248 sig_builder.AddReturn(MachineRepresentation::kWord32); |
| 249 |
| 250 Node* store = graph()->NewNode(machine()->Store(rep32), Int32Constant(base), |
| 251 Int32Constant(index), Int64Constant(value(0)), |
| 252 start(), start()); |
| 253 |
| 254 Node* zero = graph()->NewNode(common()->Int32Constant(0)); |
| 255 Node* ret = graph()->NewNode(common()->Return(), zero, |
| 256 Int32Constant(return_value), store, start()); |
| 257 |
| 258 NodeProperties::MergeControlToEnd(graph(), common(), ret); |
| 259 |
| 260 Int64Lowering lowering(graph(), machine(), common(), zone(), |
| 261 sig_builder.Build()); |
| 262 lowering.LowerGraph(); |
| 263 |
| 264 EXPECT_THAT( |
| 265 graph()->end()->InputAt(1), |
| 266 IsReturn(IsInt32Constant(return_value), |
| 267 IsStore(rep32, IsInt32Constant(base), IsInt32Constant(index), |
| 268 IsInt32Constant(low_word_value(0)), start(), start()), |
| 269 start())); |
| 270 } |
| 271 |
240 TEST_F(Int64LoweringTest, Int64UnalignedStore) { | 272 TEST_F(Int64LoweringTest, Int64UnalignedStore) { |
241 const UnalignedStoreRepresentation rep64(MachineRepresentation::kWord64); | 273 const UnalignedStoreRepresentation rep64(MachineRepresentation::kWord64); |
242 const UnalignedStoreRepresentation rep32(MachineRepresentation::kWord32); | 274 const UnalignedStoreRepresentation rep32(MachineRepresentation::kWord32); |
243 INT64_STORE_LOWERING(UnalignedStore, rep32, rep64); | 275 INT64_STORE_LOWERING(UnalignedStore, rep32, rep64); |
244 } | 276 } |
245 | 277 |
246 TEST_F(Int64LoweringTest, Int64And) { | 278 TEST_F(Int64LoweringTest, Int64And) { |
247 LowerGraph(graph()->NewNode(machine()->Word64And(), Int64Constant(value(0)), | 279 LowerGraph(graph()->NewNode(machine()->Word64And(), Int64Constant(value(0)), |
248 Int64Constant(value(1))), | 280 Int64Constant(value(1))), |
249 MachineRepresentation::kWord64); | 281 MachineRepresentation::kWord64); |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 graph()->NewNode(common()->Branch(), compare, | 920 graph()->NewNode(common()->Branch(), compare, |
889 graph()->start())))); | 921 graph()->start())))); |
890 | 922 |
891 NodeProperties::ReplaceValueInput(compare, load, 0); | 923 NodeProperties::ReplaceValueInput(compare, load, 0); |
892 | 924 |
893 LowerGraph(load, MachineRepresentation::kWord64); | 925 LowerGraph(load, MachineRepresentation::kWord64); |
894 } | 926 } |
895 } // namespace compiler | 927 } // namespace compiler |
896 } // namespace internal | 928 } // namespace internal |
897 } // namespace v8 | 929 } // namespace v8 |
OLD | NEW |