| 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 "test/unittests/compiler/instruction-selector-unittest.h" | 5 #include "test/unittests/compiler/instruction-selector-unittest.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 namespace compiler { | 9 namespace compiler { |
| 10 | 10 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 Stream s = m.Build(); | 639 Stream s = m.Build(); |
| 640 ASSERT_EQ(1U, s.size()); | 640 ASSERT_EQ(1U, s.size()); |
| 641 EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode()); | 641 EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode()); |
| 642 EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 642 EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); |
| 643 } | 643 } |
| 644 | 644 |
| 645 | 645 |
| 646 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { | 646 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { |
| 647 const MemoryAccess memacc = GetParam(); | 647 const MemoryAccess memacc = GetParam(); |
| 648 StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type); | 648 StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type); |
| 649 m.Store(memacc.type, m.Parameter(0), m.Parameter(1)); | 649 StoreRepresentation store_rep(memacc.type, kNoWriteBarrier); |
| 650 m.Store(store_rep, m.Parameter(0), m.Parameter(1)); |
| 650 m.Return(m.Int32Constant(0)); | 651 m.Return(m.Int32Constant(0)); |
| 651 Stream s = m.Build(); | 652 Stream s = m.Build(); |
| 652 ASSERT_EQ(1U, s.size()); | 653 ASSERT_EQ(1U, s.size()); |
| 653 EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); | 654 EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); |
| 654 EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 655 EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); |
| 655 } | 656 } |
| 656 | 657 |
| 657 | 658 |
| 658 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, | 659 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
| 659 InstructionSelectorMemoryAccessTest, | 660 InstructionSelectorMemoryAccessTest, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 689 | 690 |
| 690 // ---------------------------------------------------------------------------- | 691 // ---------------------------------------------------------------------------- |
| 691 // Store immediate. | 692 // Store immediate. |
| 692 // ---------------------------------------------------------------------------- | 693 // ---------------------------------------------------------------------------- |
| 693 | 694 |
| 694 | 695 |
| 695 TEST_P(InstructionSelectorMemoryAccessImmTest, StoreWithImmediateIndex) { | 696 TEST_P(InstructionSelectorMemoryAccessImmTest, StoreWithImmediateIndex) { |
| 696 const MemoryAccessImm memacc = GetParam(); | 697 const MemoryAccessImm memacc = GetParam(); |
| 697 TRACED_FOREACH(int32_t, index, memacc.immediates) { | 698 TRACED_FOREACH(int32_t, index, memacc.immediates) { |
| 698 StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type); | 699 StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type); |
| 699 m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), | 700 StoreRepresentation store_rep(memacc.type, kNoWriteBarrier); |
| 700 m.Parameter(1)); | 701 m.Store(store_rep, m.Parameter(0), m.Int32Constant(index), m.Parameter(1)); |
| 701 m.Return(m.Int32Constant(0)); | 702 m.Return(m.Int32Constant(0)); |
| 702 Stream s = m.Build(); | 703 Stream s = m.Build(); |
| 703 ASSERT_EQ(1U, s.size()); | 704 ASSERT_EQ(1U, s.size()); |
| 704 EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); | 705 EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); |
| 705 EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 706 EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); |
| 706 ASSERT_EQ(3U, s[0]->InputCount()); | 707 ASSERT_EQ(3U, s[0]->InputCount()); |
| 707 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); | 708 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); |
| 708 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); | 709 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); |
| 709 EXPECT_EQ(0U, s[0]->OutputCount()); | 710 EXPECT_EQ(0U, s[0]->OutputCount()); |
| 710 } | 711 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 741 EXPECT_EQ(1U, s[0]->OutputCount()); | 742 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 742 } | 743 } |
| 743 } | 744 } |
| 744 | 745 |
| 745 | 746 |
| 746 TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest, | 747 TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest, |
| 747 StoreWithImmediateIndex) { | 748 StoreWithImmediateIndex) { |
| 748 const MemoryAccessImm1 memacc = GetParam(); | 749 const MemoryAccessImm1 memacc = GetParam(); |
| 749 TRACED_FOREACH(int32_t, index, memacc.immediates) { | 750 TRACED_FOREACH(int32_t, index, memacc.immediates) { |
| 750 StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type); | 751 StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type); |
| 751 m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), | 752 StoreRepresentation store_rep(memacc.type, kNoWriteBarrier); |
| 752 m.Parameter(1)); | 753 m.Store(store_rep, m.Parameter(0), m.Int32Constant(index), m.Parameter(1)); |
| 753 m.Return(m.Int32Constant(0)); | 754 m.Return(m.Int32Constant(0)); |
| 754 Stream s = m.Build(); | 755 Stream s = m.Build(); |
| 755 ASSERT_EQ(2U, s.size()); | 756 ASSERT_EQ(2U, s.size()); |
| 756 // kMipsAdd is expected opcode | 757 // kMipsAdd is expected opcode |
| 757 // size more than 16 bits wide | 758 // size more than 16 bits wide |
| 758 EXPECT_EQ(kMipsAdd, s[0]->arch_opcode()); | 759 EXPECT_EQ(kMipsAdd, s[0]->arch_opcode()); |
| 759 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); | 760 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); |
| 760 EXPECT_EQ(2U, s[0]->InputCount()); | 761 EXPECT_EQ(2U, s[0]->InputCount()); |
| 761 EXPECT_EQ(1U, s[0]->OutputCount()); | 762 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 762 } | 763 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 EXPECT_EQ(kMipsAbsD, s[0]->arch_opcode()); | 842 EXPECT_EQ(kMipsAbsD, s[0]->arch_opcode()); |
| 842 ASSERT_EQ(1U, s[0]->InputCount()); | 843 ASSERT_EQ(1U, s[0]->InputCount()); |
| 843 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 844 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 844 ASSERT_EQ(1U, s[0]->OutputCount()); | 845 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 845 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 846 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 846 } | 847 } |
| 847 | 848 |
| 848 } // namespace compiler | 849 } // namespace compiler |
| 849 } // namespace internal | 850 } // namespace internal |
| 850 } // namespace v8 | 851 } // namespace v8 |
| OLD | NEW |