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/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/compiler/linkage.h" | 6 #include "src/compiler/linkage.h" |
7 #include "src/compiler/register-allocator.h" | 7 #include "src/compiler/register-allocator.h" |
8 #include "src/string-stream.h" | 8 #include "src/string-stream.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2190 | 2190 |
2191 | 2191 |
2192 void LiveRangeBuilder::ProcessPhis(const InstructionBlock* block, | 2192 void LiveRangeBuilder::ProcessPhis(const InstructionBlock* block, |
2193 BitVector* live) { | 2193 BitVector* live) { |
2194 for (PhiInstruction* phi : block->phis()) { | 2194 for (PhiInstruction* phi : block->phis()) { |
2195 // The live range interval already ends at the first instruction of the | 2195 // The live range interval already ends at the first instruction of the |
2196 // block. | 2196 // block. |
2197 int phi_vreg = phi->virtual_register(); | 2197 int phi_vreg = phi->virtual_register(); |
2198 live->Remove(phi_vreg); | 2198 live->Remove(phi_vreg); |
2199 InstructionOperand* hint = nullptr; | 2199 InstructionOperand* hint = nullptr; |
2200 Instruction* instr = GetLastInstruction( | 2200 const InstructionBlock::Predecessors& predecessors = block->predecessors(); |
2201 code(), code()->InstructionBlockAt(block->predecessors()[0])); | 2201 const InstructionBlock* predecessor_block = |
| 2202 code()->InstructionBlockAt(predecessors[0]); |
| 2203 const Instruction* instr = GetLastInstruction(code(), predecessor_block); |
| 2204 if (predecessor_block->IsDeferred()) { |
| 2205 // "Prefer the hint from the first non-deferred predecessor, if any. |
| 2206 for (size_t i = 1; i < predecessors.size(); ++i) { |
| 2207 predecessor_block = code()->InstructionBlockAt(predecessors[i]); |
| 2208 if (!predecessor_block->IsDeferred()) { |
| 2209 instr = GetLastInstruction(code(), predecessor_block); |
| 2210 break; |
| 2211 } |
| 2212 } |
| 2213 } |
| 2214 DCHECK_NOT_NULL(instr); |
| 2215 |
2202 for (MoveOperands* move : *instr->GetParallelMove(Instruction::END)) { | 2216 for (MoveOperands* move : *instr->GetParallelMove(Instruction::END)) { |
2203 InstructionOperand& to = move->destination(); | 2217 InstructionOperand& to = move->destination(); |
2204 if (to.IsUnallocated() && | 2218 if (to.IsUnallocated() && |
2205 UnallocatedOperand::cast(to).virtual_register() == phi_vreg) { | 2219 UnallocatedOperand::cast(to).virtual_register() == phi_vreg) { |
2206 hint = &move->source(); | 2220 hint = &move->source(); |
2207 break; | 2221 break; |
2208 } | 2222 } |
2209 } | 2223 } |
2210 DCHECK(hint != nullptr); | 2224 DCHECK(hint != nullptr); |
2211 LifetimePosition block_start = LifetimePosition::GapFromInstructionIndex( | 2225 LifetimePosition block_start = LifetimePosition::GapFromInstructionIndex( |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3580 spill_operand); | 3594 spill_operand); |
3581 } | 3595 } |
3582 } | 3596 } |
3583 } | 3597 } |
3584 } | 3598 } |
3585 | 3599 |
3586 | 3600 |
3587 } // namespace compiler | 3601 } // namespace compiler |
3588 } // namespace internal | 3602 } // namespace internal |
3589 } // namespace v8 | 3603 } // namespace v8 |
OLD | NEW |