| 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 MachineRepresentation* BuildParameterArray(Zone* zone) { | 30 static MachineType* BuildParameterArray(Zone* zone) { |
| 31 MachineRepresentation* array = | 31 MachineType* array = zone->NewArray<MachineType>(kParameterCount); |
| 32 zone->NewArray<MachineRepresentation>(kParameterCount); | |
| 33 for (int i = 0; i < kParameterCount; ++i) { | 32 for (int i = 0; i < kParameterCount; ++i) { |
| 34 array[i] = kMachineWord32; | 33 array[i] = kMachineWord32; |
| 35 } | 34 } |
| 36 return array; | 35 return array; |
| 37 } | 36 } |
| 38 | 37 |
| 39 InstructionSelectorTester() | 38 InstructionSelectorTester() |
| 40 : RawMachineAssembler( | 39 : RawMachineAssembler( |
| 41 new (main_zone()) Graph(main_zone()), new (main_zone()) | 40 new (main_zone()) Graph(main_zone()), new (main_zone()) |
| 42 MachineCallDescriptorBuilder(kMachineWord32, kParameterCount, | 41 MachineCallDescriptorBuilder(kMachineWord32, kParameterCount, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 CHECK_EQ(InstructionOperand::UNALLOCATED, val->kind()); | 118 CHECK_EQ(InstructionOperand::UNALLOCATED, val->kind()); |
| 120 CHECK_EQ(UnallocatedOperand::cast(exp)->virtual_register(), | 119 CHECK_EQ(UnallocatedOperand::cast(exp)->virtual_register(), |
| 121 UnallocatedOperand::cast(val)->virtual_register()); | 120 UnallocatedOperand::cast(val)->virtual_register()); |
| 122 } | 121 } |
| 123 | 122 |
| 124 } // namespace compiler | 123 } // namespace compiler |
| 125 } // namespace internal | 124 } // namespace internal |
| 126 } // namespace v8 | 125 } // namespace v8 |
| 127 | 126 |
| 128 #endif // V8_CCTEST_COMPILER_INSTRUCTION_SELECTOR_TEST_H_ | 127 #endif // V8_CCTEST_COMPILER_INSTRUCTION_SELECTOR_TEST_H_ |
| OLD | NEW |