Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: test/unittests/compiler/instruction-sequence-unittest.h

Issue 800493002: [turbofan] improve register allocator testing framework (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | test/unittests/compiler/instruction-sequence-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ 5 #ifndef V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_
6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ 6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_
7 7
8 #include "src/compiler/instruction.h" 8 #include "src/compiler/instruction.h"
9 #include "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 18 matching lines...) Expand all
29 29
30 enum TestOperandType { 30 enum TestOperandType {
31 kInvalid, 31 kInvalid,
32 kSameAsFirst, 32 kSameAsFirst,
33 kRegister, 33 kRegister,
34 kFixedRegister, 34 kFixedRegister,
35 kSlot, 35 kSlot,
36 kFixedSlot, 36 kFixedSlot,
37 kImmediate, 37 kImmediate,
38 kNone, 38 kNone,
39 kConstant 39 kConstant,
40 kUnique,
41 kUniqueRegister
40 }; 42 };
41 43
42 struct TestOperand { 44 struct TestOperand {
43 TestOperand() : type_(kInvalid), vreg_(), value_(kNoValue) {} 45 TestOperand() : type_(kInvalid), vreg_(), value_(kNoValue) {}
44 TestOperand(TestOperandType type, int imm) 46 TestOperand(TestOperandType type, int imm)
45 : type_(type), vreg_(), value_(imm) {} 47 : type_(type), vreg_(), value_(imm) {}
46 TestOperand(TestOperandType type, VReg vreg, int value = kNoValue) 48 TestOperand(TestOperandType type, VReg vreg, int value = kNoValue)
47 : type_(type), vreg_(vreg), value_(value) {} 49 : type_(type), vreg_(vreg), value_(value) {}
48 50
49 TestOperandType type_; 51 TestOperandType type_;
(...skipping 21 matching lines...) Expand all
71 73
72 static TestOperand Const(int index) { 74 static TestOperand Const(int index) {
73 CHECK_NE(kNoValue, index); 75 CHECK_NE(kNoValue, index);
74 return TestOperand(kConstant, VReg(), index); 76 return TestOperand(kConstant, VReg(), index);
75 } 77 }
76 78
77 static TestOperand Use(VReg vreg) { return TestOperand(kNone, vreg); } 79 static TestOperand Use(VReg vreg) { return TestOperand(kNone, vreg); }
78 80
79 static TestOperand Use() { return Use(VReg()); } 81 static TestOperand Use() { return Use(VReg()); }
80 82
83 static TestOperand Unique(VReg vreg) { return TestOperand(kUnique, vreg); }
84
85 static TestOperand UniqueReg(VReg vreg) {
86 return TestOperand(kUniqueRegister, vreg);
87 }
88
81 enum BlockCompletionType { kBlockEnd, kFallThrough, kBranch, kJump }; 89 enum BlockCompletionType { kBlockEnd, kFallThrough, kBranch, kJump };
82 90
83 struct BlockCompletion { 91 struct BlockCompletion {
84 BlockCompletionType type_; 92 BlockCompletionType type_;
85 TestOperand op_; 93 TestOperand op_;
86 int offset_0_; 94 int offset_0_;
87 int offset_1_; 95 int offset_1_;
88 }; 96 };
89 97
90 static BlockCompletion FallThrough() { 98 static BlockCompletion FallThrough() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 int Return(VReg vreg) { return Return(Reg(vreg, 0)); } 135 int Return(VReg vreg) { return Return(Reg(vreg, 0)); }
128 136
129 PhiInstruction* Phi(VReg incoming_vreg_0 = VReg(), 137 PhiInstruction* Phi(VReg incoming_vreg_0 = VReg(),
130 VReg incoming_vreg_1 = VReg(), 138 VReg incoming_vreg_1 = VReg(),
131 VReg incoming_vreg_2 = VReg(), 139 VReg incoming_vreg_2 = VReg(),
132 VReg incoming_vreg_3 = VReg()); 140 VReg incoming_vreg_3 = VReg());
133 void Extend(PhiInstruction* phi, VReg vreg); 141 void Extend(PhiInstruction* phi, VReg vreg);
134 142
135 VReg DefineConstant(int32_t imm = 0); 143 VReg DefineConstant(int32_t imm = 0);
136 int EmitNop(); 144 int EmitNop();
137 int EmitI(TestOperand input_op_0); 145 int EmitI(size_t input_size, TestOperand* inputs);
138 VReg EmitOI(TestOperand output_op, TestOperand input_op_0); 146 int EmitI(TestOperand input_op_0 = TestOperand(),
139 VReg EmitOII(TestOperand output_op, TestOperand input_op_0, 147 TestOperand input_op_1 = TestOperand(),
140 TestOperand input_op_1); 148 TestOperand input_op_2 = TestOperand(),
149 TestOperand input_op_3 = TestOperand());
150 VReg EmitOI(TestOperand output_op, size_t input_size, TestOperand* inputs);
151 VReg EmitOI(TestOperand output_op, TestOperand input_op_0 = TestOperand(),
152 TestOperand input_op_1 = TestOperand(),
153 TestOperand input_op_2 = TestOperand(),
154 TestOperand input_op_3 = TestOperand());
141 VReg EmitCall(TestOperand output_op, size_t input_size, TestOperand* inputs); 155 VReg EmitCall(TestOperand output_op, size_t input_size, TestOperand* inputs);
142 VReg EmitCall(TestOperand output_op, TestOperand input_op_0 = TestOperand(), 156 VReg EmitCall(TestOperand output_op, TestOperand input_op_0 = TestOperand(),
143 TestOperand input_op_1 = TestOperand(), 157 TestOperand input_op_1 = TestOperand(),
144 TestOperand input_op_2 = TestOperand(), 158 TestOperand input_op_2 = TestOperand(),
145 TestOperand input_op_3 = TestOperand()); 159 TestOperand input_op_3 = TestOperand());
146 160
147 // Get defining instruction vreg or value returned at instruction creation 161 // Get defining instruction vreg or value returned at instruction creation
148 // time when there is no return value. 162 // time when there is no return value.
149 const Instruction* GetInstruction(int instruction_index); 163 const Instruction* GetInstruction(int instruction_index);
150 164
(...skipping 23 matching lines...) Expand all
174 UnallocatedOperand::ExtendedPolicy policy); 188 UnallocatedOperand::ExtendedPolicy policy);
175 InstructionOperand* Unallocated(TestOperand op, 189 InstructionOperand* Unallocated(TestOperand op,
176 UnallocatedOperand::ExtendedPolicy policy, 190 UnallocatedOperand::ExtendedPolicy policy,
177 UnallocatedOperand::Lifetime lifetime); 191 UnallocatedOperand::Lifetime lifetime);
178 InstructionOperand* Unallocated(TestOperand op, 192 InstructionOperand* Unallocated(TestOperand op,
179 UnallocatedOperand::ExtendedPolicy policy, 193 UnallocatedOperand::ExtendedPolicy policy,
180 int index); 194 int index);
181 InstructionOperand* Unallocated(TestOperand op, 195 InstructionOperand* Unallocated(TestOperand op,
182 UnallocatedOperand::BasicPolicy policy, 196 UnallocatedOperand::BasicPolicy policy,
183 int index); 197 int index);
198 InstructionOperand** ConvertInputs(size_t input_size, TestOperand* inputs);
184 InstructionOperand* ConvertInputOp(TestOperand op); 199 InstructionOperand* ConvertInputOp(TestOperand op);
185 InstructionOperand* ConvertOutputOp(VReg vreg, TestOperand op); 200 InstructionOperand* ConvertOutputOp(VReg vreg, TestOperand op);
186 InstructionBlock* NewBlock(); 201 InstructionBlock* NewBlock();
187 void WireBlock(size_t block_offset, int jump_offset); 202 void WireBlock(size_t block_offset, int jump_offset);
188 203
189 int Emit(int instruction_index, InstructionCode code, size_t outputs_size = 0, 204 int Emit(int instruction_index, InstructionCode code, size_t outputs_size = 0,
190 InstructionOperand* *outputs = nullptr, size_t inputs_size = 0, 205 InstructionOperand* *outputs = nullptr, size_t inputs_size = 0,
191 InstructionOperand* *inputs = nullptr, size_t temps_size = 0, 206 InstructionOperand* *inputs = nullptr, size_t temps_size = 0,
192 InstructionOperand* *temps = nullptr, bool is_call = false); 207 InstructionOperand* *temps = nullptr, bool is_call = false);
193 208
(...skipping 21 matching lines...) Expand all
215 LoopBlocks loop_blocks_; 230 LoopBlocks loop_blocks_;
216 InstructionBlock* current_block_; 231 InstructionBlock* current_block_;
217 bool block_returns_; 232 bool block_returns_;
218 }; 233 };
219 234
220 } // namespace compiler 235 } // namespace compiler
221 } // namespace internal 236 } // namespace internal
222 } // namespace v8 237 } // namespace v8
223 238
224 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ 239 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | test/unittests/compiler/instruction-sequence-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698