| 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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 873   ASSERT_EQ(1U, s.size()); | 873   ASSERT_EQ(1U, s.size()); | 
| 874   EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode()); | 874   EXPECT_EQ(memacc.load_opcode, s[0]->arch_opcode()); | 
| 875   EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 875   EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 
| 876 } | 876 } | 
| 877 | 877 | 
| 878 | 878 | 
| 879 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { | 879 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { | 
| 880   const MemoryAccess memacc = GetParam(); | 880   const MemoryAccess memacc = GetParam(); | 
| 881   StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 881   StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 
| 882                   MachineType::Int32(), memacc.type); | 882                   MachineType::Int32(), memacc.type); | 
| 883   m.Store(memacc.type, m.Parameter(0), m.Parameter(1), kNoWriteBarrier); | 883   m.Store(memacc.type.representation(), m.Parameter(0), m.Parameter(1), | 
|  | 884           kNoWriteBarrier); | 
| 884   m.Return(m.Int32Constant(0)); | 885   m.Return(m.Int32Constant(0)); | 
| 885   Stream s = m.Build(); | 886   Stream s = m.Build(); | 
| 886   ASSERT_EQ(1U, s.size()); | 887   ASSERT_EQ(1U, s.size()); | 
| 887   EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); | 888   EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); | 
| 888   EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 889   EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 
| 889 } | 890 } | 
| 890 | 891 | 
| 891 | 892 | 
| 892 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, | 893 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, | 
| 893                         InstructionSelectorMemoryAccessTest, | 894                         InstructionSelectorMemoryAccessTest, | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 924 // ---------------------------------------------------------------------------- | 925 // ---------------------------------------------------------------------------- | 
| 925 // Store immediate. | 926 // Store immediate. | 
| 926 // ---------------------------------------------------------------------------- | 927 // ---------------------------------------------------------------------------- | 
| 927 | 928 | 
| 928 | 929 | 
| 929 TEST_P(InstructionSelectorMemoryAccessImmTest, StoreWithImmediateIndex) { | 930 TEST_P(InstructionSelectorMemoryAccessImmTest, StoreWithImmediateIndex) { | 
| 930   const MemoryAccessImm memacc = GetParam(); | 931   const MemoryAccessImm memacc = GetParam(); | 
| 931   TRACED_FOREACH(int32_t, index, memacc.immediates) { | 932   TRACED_FOREACH(int32_t, index, memacc.immediates) { | 
| 932     StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 933     StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 
| 933                     memacc.type); | 934                     memacc.type); | 
| 934     m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1), | 935     m.Store(memacc.type.representation(), m.Parameter(0), | 
| 935             kNoWriteBarrier); | 936             m.Int32Constant(index), m.Parameter(1), kNoWriteBarrier); | 
| 936     m.Return(m.Int32Constant(0)); | 937     m.Return(m.Int32Constant(0)); | 
| 937     Stream s = m.Build(); | 938     Stream s = m.Build(); | 
| 938     ASSERT_EQ(1U, s.size()); | 939     ASSERT_EQ(1U, s.size()); | 
| 939     EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); | 940     EXPECT_EQ(memacc.store_opcode, s[0]->arch_opcode()); | 
| 940     EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 941     EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 
| 941     ASSERT_EQ(3U, s[0]->InputCount()); | 942     ASSERT_EQ(3U, s[0]->InputCount()); | 
| 942     ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); | 943     ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); | 
| 943     EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); | 944     EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); | 
| 944     EXPECT_EQ(0U, s[0]->OutputCount()); | 945     EXPECT_EQ(0U, s[0]->OutputCount()); | 
| 945   } | 946   } | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 977   } | 978   } | 
| 978 } | 979 } | 
| 979 | 980 | 
| 980 | 981 | 
| 981 TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest, | 982 TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest, | 
| 982        StoreWithImmediateIndex) { | 983        StoreWithImmediateIndex) { | 
| 983   const MemoryAccessImm1 memacc = GetParam(); | 984   const MemoryAccessImm1 memacc = GetParam(); | 
| 984   TRACED_FOREACH(int32_t, index, memacc.immediates) { | 985   TRACED_FOREACH(int32_t, index, memacc.immediates) { | 
| 985     StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 986     StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 
| 986                     memacc.type); | 987                     memacc.type); | 
| 987     m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1), | 988     m.Store(memacc.type.representation(), m.Parameter(0), | 
| 988             kNoWriteBarrier); | 989             m.Int32Constant(index), m.Parameter(1), kNoWriteBarrier); | 
| 989     m.Return(m.Int32Constant(0)); | 990     m.Return(m.Int32Constant(0)); | 
| 990     Stream s = m.Build(); | 991     Stream s = m.Build(); | 
| 991     ASSERT_EQ(2U, s.size()); | 992     ASSERT_EQ(2U, s.size()); | 
| 992     // kMipsAdd is expected opcode | 993     // kMipsAdd is expected opcode | 
| 993     // size more than 16 bits wide | 994     // size more than 16 bits wide | 
| 994     EXPECT_EQ(kMipsAdd, s[0]->arch_opcode()); | 995     EXPECT_EQ(kMipsAdd, s[0]->arch_opcode()); | 
| 995     EXPECT_EQ(kMode_None, s[0]->addressing_mode()); | 996     EXPECT_EQ(kMode_None, s[0]->addressing_mode()); | 
| 996     EXPECT_EQ(2U, s[0]->InputCount()); | 997     EXPECT_EQ(2U, s[0]->InputCount()); | 
| 997     EXPECT_EQ(1U, s[0]->OutputCount()); | 998     EXPECT_EQ(1U, s[0]->OutputCount()); | 
| 998   } | 999   } | 
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1146   EXPECT_EQ(kMipsFloat64Min, s[0]->arch_opcode()); | 1147   EXPECT_EQ(kMipsFloat64Min, s[0]->arch_opcode()); | 
| 1147   ASSERT_EQ(2U, s[0]->InputCount()); | 1148   ASSERT_EQ(2U, s[0]->InputCount()); | 
| 1148   ASSERT_EQ(1U, s[0]->OutputCount()); | 1149   ASSERT_EQ(1U, s[0]->OutputCount()); | 
| 1149   EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 1150   EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 
| 1150 } | 1151 } | 
| 1151 | 1152 | 
| 1152 | 1153 | 
| 1153 }  // namespace compiler | 1154 }  // namespace compiler | 
| 1154 }  // namespace internal | 1155 }  // namespace internal | 
| 1155 }  // namespace v8 | 1156 }  // namespace v8 | 
| OLD | NEW | 
|---|