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/compiler/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
6 #include "test/unittests/compiler/instruction-sequence-unittest.h" | 6 #include "test/unittests/compiler/instruction-sequence-unittest.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // values[0] will be split in the second half of this instruction. | 294 // values[0] will be split in the second half of this instruction. |
295 // Models Intel mod instructions. | 295 // Models Intel mod instructions. |
296 EmitOI(Reg(0), Reg(p_0, 1), UniqueReg(p_1)); | 296 EmitOI(Reg(0), Reg(p_0, 1), UniqueReg(p_1)); |
297 EmitI(Reg(values[0], 0)); | 297 EmitI(Reg(values[0], 0)); |
298 EndBlock(Last()); | 298 EndBlock(Last()); |
299 | 299 |
300 Allocate(); | 300 Allocate(); |
301 } | 301 } |
302 | 302 |
303 | 303 |
| 304 TEST_F(RegisterAllocatorTest, SplitBeforeInstruction2) { |
| 305 const int kNumRegs = 6; |
| 306 SetNumRegs(kNumRegs, kNumRegs); |
| 307 |
| 308 StartBlock(); |
| 309 |
| 310 // Stack parameters/spilled values. |
| 311 auto p_0 = Define(Slot(-1)); |
| 312 auto p_1 = Define(Slot(-2)); |
| 313 |
| 314 // Fill registers. |
| 315 VReg values[kNumRegs]; |
| 316 for (size_t i = 0; i < arraysize(values); ++i) { |
| 317 values[i] = Define(Reg(static_cast<int>(i))); |
| 318 } |
| 319 |
| 320 // values[0] and [1] will be split in the second half of this instruction. |
| 321 EmitOOI(Reg(0), Reg(1), Reg(p_0, 0), Reg(p_1, 1)); |
| 322 EmitI(Reg(values[0]), Reg(values[1])); |
| 323 EndBlock(Last()); |
| 324 |
| 325 Allocate(); |
| 326 } |
| 327 |
| 328 |
304 TEST_F(RegisterAllocatorTest, NestedDiamondPhiMerge) { | 329 TEST_F(RegisterAllocatorTest, NestedDiamondPhiMerge) { |
305 // Outer diamond. | 330 // Outer diamond. |
306 StartBlock(); | 331 StartBlock(); |
307 EndBlock(Branch(Imm(), 1, 5)); | 332 EndBlock(Branch(Imm(), 1, 5)); |
308 | 333 |
309 // Diamond 1 | 334 // Diamond 1 |
310 StartBlock(); | 335 StartBlock(); |
311 EndBlock(Branch(Imm(), 1, 2)); | 336 EndBlock(Branch(Imm(), 1, 2)); |
312 | 337 |
313 StartBlock(); | 338 StartBlock(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 EmitI(Reg(c)); | 487 EmitI(Reg(c)); |
463 EmitI(Reg(to_spill)); | 488 EmitI(Reg(to_spill)); |
464 EndBlock(Last()); | 489 EndBlock(Last()); |
465 | 490 |
466 Allocate(); | 491 Allocate(); |
467 } | 492 } |
468 | 493 |
469 } // namespace compiler | 494 } // namespace compiler |
470 } // namespace internal | 495 } // namespace internal |
471 } // namespace v8 | 496 } // namespace v8 |
OLD | NEW |