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 #ifndef V8_CCTEST_COMPILER_INSTRUCTION_SELECTOR_TEST_H_ | 5 #ifndef V8_CCTEST_COMPILER_INSTRUCTION_SELECTOR_TEST_H_ |
6 #define V8_CCTEST_COMPILER_INSTRUCTION_SELECTOR_TEST_H_ | 6 #define V8_CCTEST_COMPILER_INSTRUCTION_SELECTOR_TEST_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "src/compiler/instruction-selector.h" | 11 #include "src/compiler/instruction-selector.h" |
12 #include "src/compiler/raw-machine-assembler.h" | 12 #include "src/compiler/raw-machine-assembler.h" |
13 #include "src/ostreams.h" | 13 #include "src/ostreams.h" |
14 #include "test/cctest/cctest.h" | 14 #include "test/cctest/cctest.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 namespace compiler { | 18 namespace compiler { |
19 | 19 |
20 typedef std::set<int> VirtualRegisterSet; | 20 typedef std::set<int> VirtualRegisterSet; |
21 | 21 |
22 enum InstructionSelectorTesterMode { kTargetMode, kInternalMode }; | 22 enum InstructionSelectorTesterMode { kTargetMode, kInternalMode }; |
23 | 23 |
24 class InstructionSelectorTester : public HandleAndZoneScope, | 24 class InstructionSelectorTester : public HandleAndZoneScope, |
25 public RawMachineAssembler { | 25 public RawMachineAssembler { |
26 public: | 26 public: |
27 enum Mode { kTargetMode, kInternalMode }; | 27 enum Mode { kTargetMode, kInternalMode }; |
28 | 28 |
29 static const int kParameterCount = 3; | 29 static const int kParameterCount = 3; |
30 static MachineType* BuildParameterArray(Zone* zone) { | 30 static CallDescriptor* BuildCallDescriptor(Zone* zone) { |
31 MachineType* array = zone->NewArray<MachineType>(kParameterCount); | 31 MachineType* parameter_array = zone->NewArray<MachineType>(kParameterCount); |
32 for (int i = 0; i < kParameterCount; ++i) { | 32 for (int i = 0; i < kParameterCount; ++i) { |
33 array[i] = kMachInt32; | 33 array[i] = kMachInt32; |
34 } | 34 } |
35 return array; | 35 return Linkage::GetSimplifiedCDescriptor( |
36 graph->zone(), | |
37 new (zone) MachineCallDescriptorBuilder(kMachInt32, kParameterCount, | |
38 parameter_array)); | |
36 } | 39 } |
37 | 40 |
38 InstructionSelectorTester() | 41 InstructionSelectorTester() |
39 : RawMachineAssembler( | 42 : RawMachineAssembler( |
40 new (main_zone()) Graph(main_zone()), | 43 new (main_zone()) Graph(main_zone()), |
41 new (main_zone()) MachineCallDescriptorBuilder( | 44 BuildCallDescriptor(main_zone()), |
42 kMachInt32, kParameterCount, BuildParameterArray(main_zone())), | 45 kMachPtr, |
43 kMachPtr) {} | 46 machine_sig)) {} |
Michael Starzinger
2015/07/21 11:46:23
There seems to be a syntax error here. Also this e
rmcilroy
2015/07/21 15:16:55
Done.
| |
44 | 47 |
45 void SelectInstructions(CpuFeature feature) { | 48 void SelectInstructions(CpuFeature feature) { |
46 SelectInstructions(InstructionSelector::Features(feature)); | 49 SelectInstructions(InstructionSelector::Features(feature)); |
47 } | 50 } |
48 | 51 |
49 void SelectInstructions(CpuFeature feature1, CpuFeature feature2) { | 52 void SelectInstructions(CpuFeature feature1, CpuFeature feature2) { |
50 SelectInstructions(InstructionSelector::Features(feature1, feature2)); | 53 SelectInstructions(InstructionSelector::Features(feature1, feature2)); |
51 } | 54 } |
52 | 55 |
53 void SelectInstructions(Mode mode = kTargetMode) { | 56 void SelectInstructions(Mode mode = kTargetMode) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 CHECK_EQ(InstructionOperand::UNALLOCATED, val->kind()); | 121 CHECK_EQ(InstructionOperand::UNALLOCATED, val->kind()); |
119 CHECK_EQ(UnallocatedOperand::cast(exp)->virtual_register(), | 122 CHECK_EQ(UnallocatedOperand::cast(exp)->virtual_register(), |
120 UnallocatedOperand::cast(val)->virtual_register()); | 123 UnallocatedOperand::cast(val)->virtual_register()); |
121 } | 124 } |
122 | 125 |
123 } // namespace compiler | 126 } // namespace compiler |
124 } // namespace internal | 127 } // namespace internal |
125 } // namespace v8 | 128 } // namespace v8 |
126 | 129 |
127 #endif // V8_CCTEST_COMPILER_INSTRUCTION_SELECTOR_TEST_H_ | 130 #endif // V8_CCTEST_COMPILER_INSTRUCTION_SELECTOR_TEST_H_ |
OLD | NEW |