| 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 "src/base/utils/random-number-generator.h" | 5 #include "src/base/utils/random-number-generator.h" |
| 6 #include "src/compiler/instruction.h" | 6 #include "src/compiler/instruction.h" |
| 7 #include "src/compiler/pipeline.h" | 7 #include "src/compiler/pipeline.h" |
| 8 #include "test/unittests/test-utils.h" | 8 #include "test/unittests/test-utils.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 | 10 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 int Return(TestOperand input_op_0) { | 237 int Return(TestOperand input_op_0) { |
| 238 block_returns_ = true; | 238 block_returns_ = true; |
| 239 InstructionOperand* inputs[1]{ConvertInputOp(input_op_0)}; | 239 InstructionOperand* inputs[1]{ConvertInputOp(input_op_0)}; |
| 240 return Emit(NewIndex(), kArchRet, 0, nullptr, 1, inputs); | 240 return Emit(NewIndex(), kArchRet, 0, nullptr, 1, inputs); |
| 241 } | 241 } |
| 242 | 242 |
| 243 int Return(VReg vreg) { return Return(Reg(vreg, 0)); } | 243 int Return(VReg vreg) { return Return(Reg(vreg, 0)); } |
| 244 | 244 |
| 245 PhiInstruction* Phi(VReg incoming_vreg) { | 245 PhiInstruction* Phi(VReg incoming_vreg) { |
| 246 PhiInstruction* phi = new (zone()) PhiInstruction(zone(), NewReg().value_); | 246 PhiInstruction* phi = |
| 247 phi->operands().push_back(incoming_vreg.value_); | 247 new (zone()) PhiInstruction(zone(), NewReg().value_, 10); |
| 248 phi->Extend(zone(), incoming_vreg.value_); |
| 248 current_block_->AddPhi(phi); | 249 current_block_->AddPhi(phi); |
| 249 return phi; | 250 return phi; |
| 250 } | 251 } |
| 251 | 252 |
| 252 PhiInstruction* Phi(VReg incoming_vreg_0, VReg incoming_vreg_1) { | 253 PhiInstruction* Phi(VReg incoming_vreg_0, VReg incoming_vreg_1) { |
| 253 auto phi = Phi(incoming_vreg_0); | 254 auto phi = Phi(incoming_vreg_0); |
| 254 Extend(phi, incoming_vreg_1); | 255 Extend(phi, incoming_vreg_1); |
| 255 return phi; | 256 return phi; |
| 256 } | 257 } |
| 257 | 258 |
| 258 static void Extend(PhiInstruction* phi, VReg vreg) { | 259 void Extend(PhiInstruction* phi, VReg vreg) { |
| 259 phi->operands().push_back(vreg.value_); | 260 phi->Extend(zone(), vreg.value_); |
| 260 } | 261 } |
| 261 | 262 |
| 262 VReg DefineConstant(int32_t imm = 0) { | 263 VReg DefineConstant(int32_t imm = 0) { |
| 263 VReg vreg = NewReg(); | 264 VReg vreg = NewReg(); |
| 264 sequence()->AddConstant(vreg.value_, Constant(imm)); | 265 sequence()->AddConstant(vreg.value_, Constant(imm)); |
| 265 InstructionOperand* outputs[1]{ | 266 InstructionOperand* outputs[1]{ |
| 266 ConstantOperand::Create(vreg.value_, zone())}; | 267 ConstantOperand::Create(vreg.value_, zone())}; |
| 267 Emit(vreg.value_, kArchNop, 1, outputs); | 268 Emit(vreg.value_, kArchNop, 1, outputs); |
| 268 return vreg; | 269 return vreg; |
| 269 } | 270 } |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 StartBlock(); | 725 StartBlock(); |
| 725 Return(DefineConstant()); | 726 Return(DefineConstant()); |
| 726 EndBlock(); | 727 EndBlock(); |
| 727 | 728 |
| 728 Allocate(); | 729 Allocate(); |
| 729 } | 730 } |
| 730 | 731 |
| 731 } // namespace compiler | 732 } // namespace compiler |
| 732 } // namespace internal | 733 } // namespace internal |
| 733 } // namespace v8 | 734 } // namespace v8 |
| OLD | NEW |