| 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 24 matching lines...) Expand all Loading... |
| 35 // i = K; | 35 // i = K; |
| 36 // while(true) { i++ } | 36 // while(true) { i++ } |
| 37 StartBlock(); | 37 StartBlock(); |
| 38 auto i_reg = DefineConstant(); | 38 auto i_reg = DefineConstant(); |
| 39 EndBlock(); | 39 EndBlock(); |
| 40 | 40 |
| 41 { | 41 { |
| 42 StartLoop(1); | 42 StartLoop(1); |
| 43 | 43 |
| 44 StartBlock(); | 44 StartBlock(); |
| 45 auto phi = Phi(i_reg); | 45 auto phi = Phi(i_reg, 2); |
| 46 auto ipp = EmitOI(Same(), Reg(phi), Use(DefineConstant())); | 46 auto ipp = EmitOI(Same(), Reg(phi), Use(DefineConstant())); |
| 47 Extend(phi, ipp); | 47 SetInput(phi, 1, ipp); |
| 48 EndBlock(Jump(0)); | 48 EndBlock(Jump(0)); |
| 49 | 49 |
| 50 EndLoop(); | 50 EndLoop(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 Allocate(); | 53 Allocate(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 | 56 |
| 57 TEST_F(RegisterAllocatorTest, SimpleBranch) { | 57 TEST_F(RegisterAllocatorTest, SimpleBranch) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 EndBlock(); | 199 EndBlock(); |
| 200 | 200 |
| 201 PhiInstruction* phis[kParams]; | 201 PhiInstruction* phis[kParams]; |
| 202 { | 202 { |
| 203 StartLoop(2); | 203 StartLoop(2); |
| 204 | 204 |
| 205 // Loop header. | 205 // Loop header. |
| 206 StartBlock(); | 206 StartBlock(); |
| 207 | 207 |
| 208 for (size_t i = 0; i < arraysize(parameters); ++i) { | 208 for (size_t i = 0; i < arraysize(parameters); ++i) { |
| 209 phis[i] = Phi(parameters[i]); | 209 phis[i] = Phi(parameters[i], 2); |
| 210 } | 210 } |
| 211 | 211 |
| 212 // Perform some computations. | 212 // Perform some computations. |
| 213 // something like phi[i] += const | 213 // something like phi[i] += const |
| 214 for (size_t i = 0; i < arraysize(parameters); ++i) { | 214 for (size_t i = 0; i < arraysize(parameters); ++i) { |
| 215 auto result = EmitOI(Same(), Reg(phis[i]), Use(constant)); | 215 auto result = EmitOI(Same(), Reg(phis[i]), Use(constant)); |
| 216 Extend(phis[i], result); | 216 SetInput(phis[i], 1, result); |
| 217 } | 217 } |
| 218 | 218 |
| 219 EndBlock(Branch(Reg(DefineConstant()), 1, 2)); | 219 EndBlock(Branch(Reg(DefineConstant()), 1, 2)); |
| 220 | 220 |
| 221 // Jump back to loop header. | 221 // Jump back to loop header. |
| 222 StartBlock(); | 222 StartBlock(); |
| 223 EndBlock(Jump(-1)); | 223 EndBlock(Jump(-1)); |
| 224 | 224 |
| 225 EndLoop(); | 225 EndLoop(); |
| 226 } | 226 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 EmitI(Reg(c)); | 462 EmitI(Reg(c)); |
| 463 EmitI(Reg(to_spill)); | 463 EmitI(Reg(to_spill)); |
| 464 EndBlock(Last()); | 464 EndBlock(Last()); |
| 465 | 465 |
| 466 Allocate(); | 466 Allocate(); |
| 467 } | 467 } |
| 468 | 468 |
| 469 } // namespace compiler | 469 } // namespace compiler |
| 470 } // namespace internal | 470 } // namespace internal |
| 471 } // namespace v8 | 471 } // namespace v8 |
| OLD | NEW |