| 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 387 |
| 388 // Outer diamond merge. | 388 // Outer diamond merge. |
| 389 StartBlock(); | 389 StartBlock(); |
| 390 auto phi = Phi(l_phi, r_phi); | 390 auto phi = Phi(l_phi, r_phi); |
| 391 Return(Reg(phi)); | 391 Return(Reg(phi)); |
| 392 EndBlock(); | 392 EndBlock(); |
| 393 | 393 |
| 394 Allocate(); | 394 Allocate(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 |
| 398 TEST_F(RegisterAllocatorTest, RegressionSplitBeforeAndMove) { |
| 399 StartBlock(); |
| 400 |
| 401 // Fill registers. |
| 402 VReg values[kDefaultNRegs]; |
| 403 for (size_t i = 0; i < arraysize(values); ++i) { |
| 404 if (i == 0 || i == 1) continue; // Leave a hole for c_1 to take. |
| 405 values[i] = Define(Reg(static_cast<int>(i))); |
| 406 } |
| 407 |
| 408 auto c_0 = DefineConstant(); |
| 409 auto c_1 = DefineConstant(); |
| 410 |
| 411 EmitOI(Reg(1), Reg(c_0, 0), UniqueReg(c_1)); |
| 412 |
| 413 // Use previous values to force c_1 to split before the previous instruction. |
| 414 for (size_t i = 0; i < arraysize(values); ++i) { |
| 415 if (i == 0 || i == 1) continue; |
| 416 EmitI(Reg(values[i], i)); |
| 417 } |
| 418 |
| 419 EndBlock(Last()); |
| 420 |
| 421 Allocate(); |
| 422 } |
| 423 |
| 424 |
| 425 TEST_F(RegisterAllocatorTest, RegressionSpillTwice) { |
| 426 StartBlock(); |
| 427 auto p_0 = Parameter(Reg(1)); |
| 428 EmitCall(Slot(-2), Unique(p_0), Reg(p_0, 1)); |
| 429 EndBlock(Last()); |
| 430 |
| 431 Allocate(); |
| 432 } |
| 433 |
| 434 |
| 397 } // namespace compiler | 435 } // namespace compiler |
| 398 } // namespace internal | 436 } // namespace internal |
| 399 } // namespace v8 | 437 } // namespace v8 |
| OLD | NEW |