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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "test/unittests/compiler/instruction-selector-unittest.h" | 7 #include "test/unittests/compiler/instruction-selector-unittest.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 ASSERT_EQ(1U, s[0]->OutputCount()); | 1360 ASSERT_EQ(1U, s[0]->OutputCount()); |
1361 EXPECT_TRUE((s.*memacc.val_predicate)(s[0]->Output())); | 1361 EXPECT_TRUE((s.*memacc.val_predicate)(s[0]->Output())); |
1362 } | 1362 } |
1363 } | 1363 } |
1364 | 1364 |
1365 | 1365 |
1366 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { | 1366 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { |
1367 const MemoryAccess memacc = GetParam(); | 1367 const MemoryAccess memacc = GetParam(); |
1368 StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 1368 StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), |
1369 MachineType::Int32(), memacc.type); | 1369 MachineType::Int32(), memacc.type); |
1370 m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2), | 1370 m.Store(memacc.type.representation(), m.Parameter(0), m.Parameter(1), |
1371 kNoWriteBarrier); | 1371 m.Parameter(2), kNoWriteBarrier); |
1372 m.Return(m.Int32Constant(0)); | 1372 m.Return(m.Int32Constant(0)); |
1373 Stream s = m.Build(); | 1373 Stream s = m.Build(); |
1374 ASSERT_EQ(1U, s.size()); | 1374 ASSERT_EQ(1U, s.size()); |
1375 EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode()); | 1375 EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode()); |
1376 EXPECT_EQ(kMode_Offset_RR, s[0]->addressing_mode()); | 1376 EXPECT_EQ(kMode_Offset_RR, s[0]->addressing_mode()); |
1377 EXPECT_EQ(3U, s[0]->InputCount()); | 1377 EXPECT_EQ(3U, s[0]->InputCount()); |
1378 EXPECT_EQ(0U, s[0]->OutputCount()); | 1378 EXPECT_EQ(0U, s[0]->OutputCount()); |
1379 } | 1379 } |
1380 | 1380 |
1381 | 1381 |
1382 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) { | 1382 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) { |
1383 const MemoryAccess memacc = GetParam(); | 1383 const MemoryAccess memacc = GetParam(); |
1384 TRACED_FOREACH(int32_t, index, memacc.immediates) { | 1384 TRACED_FOREACH(int32_t, index, memacc.immediates) { |
1385 StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 1385 StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), |
1386 memacc.type); | 1386 memacc.type); |
1387 m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1), | 1387 m.Store(memacc.type.representation(), m.Parameter(0), |
1388 kNoWriteBarrier); | 1388 m.Int32Constant(index), m.Parameter(1), kNoWriteBarrier); |
1389 m.Return(m.Int32Constant(0)); | 1389 m.Return(m.Int32Constant(0)); |
1390 Stream s = m.Build(); | 1390 Stream s = m.Build(); |
1391 ASSERT_EQ(1U, s.size()); | 1391 ASSERT_EQ(1U, s.size()); |
1392 EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode()); | 1392 EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode()); |
1393 EXPECT_EQ(kMode_Offset_RI, s[0]->addressing_mode()); | 1393 EXPECT_EQ(kMode_Offset_RI, s[0]->addressing_mode()); |
1394 ASSERT_EQ(3U, s[0]->InputCount()); | 1394 ASSERT_EQ(3U, s[0]->InputCount()); |
1395 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); | 1395 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); |
1396 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); | 1396 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); |
1397 EXPECT_EQ(0U, s[0]->OutputCount()); | 1397 EXPECT_EQ(0U, s[0]->OutputCount()); |
1398 } | 1398 } |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2867 EXPECT_EQ(kArmClz, s[0]->arch_opcode()); | 2867 EXPECT_EQ(kArmClz, s[0]->arch_opcode()); |
2868 ASSERT_EQ(1U, s[0]->InputCount()); | 2868 ASSERT_EQ(1U, s[0]->InputCount()); |
2869 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 2869 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
2870 ASSERT_EQ(1U, s[0]->OutputCount()); | 2870 ASSERT_EQ(1U, s[0]->OutputCount()); |
2871 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 2871 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
2872 } | 2872 } |
2873 | 2873 |
2874 } // namespace compiler | 2874 } // namespace compiler |
2875 } // namespace internal | 2875 } // namespace internal |
2876 } // namespace v8 | 2876 } // namespace v8 |
OLD | NEW |