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 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); | 2212 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); |
2213 ASSERT_EQ(1U, s[0]->OutputCount()); | 2213 ASSERT_EQ(1U, s[0]->OutputCount()); |
2214 } | 2214 } |
2215 } | 2215 } |
2216 | 2216 |
2217 | 2217 |
2218 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { | 2218 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { |
2219 const MemoryAccess memacc = GetParam(); | 2219 const MemoryAccess memacc = GetParam(); |
2220 StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 2220 StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), |
2221 MachineType::Int32(), memacc.type); | 2221 MachineType::Int32(), memacc.type); |
2222 m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2), | 2222 m.Store(memacc.type.representation(), m.Parameter(0), m.Parameter(1), |
2223 kNoWriteBarrier); | 2223 m.Parameter(2), kNoWriteBarrier); |
2224 m.Return(m.Int32Constant(0)); | 2224 m.Return(m.Int32Constant(0)); |
2225 Stream s = m.Build(); | 2225 Stream s = m.Build(); |
2226 ASSERT_EQ(1U, s.size()); | 2226 ASSERT_EQ(1U, s.size()); |
2227 EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode()); | 2227 EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode()); |
2228 EXPECT_EQ(kMode_MRR, s[0]->addressing_mode()); | 2228 EXPECT_EQ(kMode_MRR, s[0]->addressing_mode()); |
2229 EXPECT_EQ(3U, s[0]->InputCount()); | 2229 EXPECT_EQ(3U, s[0]->InputCount()); |
2230 EXPECT_EQ(0U, s[0]->OutputCount()); | 2230 EXPECT_EQ(0U, s[0]->OutputCount()); |
2231 } | 2231 } |
2232 | 2232 |
2233 | 2233 |
2234 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) { | 2234 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) { |
2235 const MemoryAccess memacc = GetParam(); | 2235 const MemoryAccess memacc = GetParam(); |
2236 TRACED_FOREACH(int32_t, index, memacc.immediates) { | 2236 TRACED_FOREACH(int32_t, index, memacc.immediates) { |
2237 StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), | 2237 StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(), |
2238 memacc.type); | 2238 memacc.type); |
2239 m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1), | 2239 m.Store(memacc.type.representation(), m.Parameter(0), |
2240 kNoWriteBarrier); | 2240 m.Int32Constant(index), m.Parameter(1), kNoWriteBarrier); |
2241 m.Return(m.Int32Constant(0)); | 2241 m.Return(m.Int32Constant(0)); |
2242 Stream s = m.Build(); | 2242 Stream s = m.Build(); |
2243 ASSERT_EQ(1U, s.size()); | 2243 ASSERT_EQ(1U, s.size()); |
2244 EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode()); | 2244 EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode()); |
2245 EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); | 2245 EXPECT_EQ(kMode_MRI, s[0]->addressing_mode()); |
2246 ASSERT_EQ(3U, s[0]->InputCount()); | 2246 ASSERT_EQ(3U, s[0]->InputCount()); |
2247 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); | 2247 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); |
2248 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); | 2248 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); |
2249 EXPECT_EQ(0U, s[0]->OutputCount()); | 2249 EXPECT_EQ(0U, s[0]->OutputCount()); |
2250 } | 2250 } |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3340 ASSERT_EQ(2U, s[0]->InputCount()); | 3340 ASSERT_EQ(2U, s[0]->InputCount()); |
3341 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 3341 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
3342 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); | 3342 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
3343 ASSERT_EQ(1U, s[0]->OutputCount()); | 3343 ASSERT_EQ(1U, s[0]->OutputCount()); |
3344 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 3344 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
3345 } | 3345 } |
3346 | 3346 |
3347 } // namespace compiler | 3347 } // namespace compiler |
3348 } // namespace internal | 3348 } // namespace internal |
3349 } // namespace v8 | 3349 } // namespace v8 |
OLD | NEW |