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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 TEST_F(RegisterAllocatorTest, RegressionSpillTwice) { | 425 TEST_F(RegisterAllocatorTest, RegressionSpillTwice) { |
426 StartBlock(); | 426 StartBlock(); |
427 auto p_0 = Parameter(Reg(1)); | 427 auto p_0 = Parameter(Reg(1)); |
428 EmitCall(Slot(-2), Unique(p_0), Reg(p_0, 1)); | 428 EmitCall(Slot(-2), Unique(p_0), Reg(p_0, 1)); |
429 EndBlock(Last()); | 429 EndBlock(Last()); |
430 | 430 |
431 Allocate(); | 431 Allocate(); |
432 } | 432 } |
433 | 433 |
434 | 434 |
| 435 TEST_F(RegisterAllocatorTest, RegressionLoadConstantBeforeSpill) { |
| 436 StartBlock(); |
| 437 // Fill registers. |
| 438 VReg values[kDefaultNRegs]; |
| 439 for (size_t i = arraysize(values); i > 0; --i) { |
| 440 values[i - 1] = Define(Reg(static_cast<int>(i - 1))); |
| 441 } |
| 442 auto c = DefineConstant(); |
| 443 auto to_spill = Define(Reg()); |
| 444 EndBlock(Jump(1)); |
| 445 |
| 446 { |
| 447 StartLoop(1); |
| 448 |
| 449 StartBlock(); |
| 450 // Create a use for c in second half of prev block's last gap |
| 451 Phi(c); |
| 452 for (size_t i = arraysize(values); i > 0; --i) { |
| 453 Phi(values[i - 1]); |
| 454 } |
| 455 EndBlock(Jump(1)); |
| 456 |
| 457 EndLoop(); |
| 458 } |
| 459 |
| 460 StartBlock(); |
| 461 // Force c to split within to_spill's definition. |
| 462 EmitI(Reg(c)); |
| 463 EmitI(Reg(to_spill)); |
| 464 EndBlock(Last()); |
| 465 |
| 466 Allocate(); |
| 467 } |
| 468 |
435 } // namespace compiler | 469 } // namespace compiler |
436 } // namespace internal | 470 } // namespace internal |
437 } // namespace v8 | 471 } // namespace v8 |
OLD | NEW |