Chromium Code Reviews| 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 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2177 } | 2177 } |
| 2178 | 2178 |
| 2179 | 2179 |
| 2180 void LiveRangeBuilder::ProcessPhis(const InstructionBlock* block, | 2180 void LiveRangeBuilder::ProcessPhis(const InstructionBlock* block, |
| 2181 BitVector* live) { | 2181 BitVector* live) { |
| 2182 for (PhiInstruction* phi : block->phis()) { | 2182 for (PhiInstruction* phi : block->phis()) { |
| 2183 // The live range interval already ends at the first instruction of the | 2183 // The live range interval already ends at the first instruction of the |
| 2184 // block. | 2184 // block. |
| 2185 int phi_vreg = phi->virtual_register(); | 2185 int phi_vreg = phi->virtual_register(); |
| 2186 live->Remove(phi_vreg); | 2186 live->Remove(phi_vreg); |
| 2187 InstructionOperand* hint = nullptr; | 2187 // Select the hint from the first predecessor block that preceeds this block |
| 2188 // in the rpo ordering. Prefer non-deferred blocks. | |
|
Mircea Trofin
2016/06/01 15:02:58
Could you add a comment as to why the rpo ordering
danno
2016/06/02 01:29:37
Done.
Mircea Trofin
2016/06/02 01:42:43
(nit, sorry) what's the motivation, though? Why do
danno
2016/06/02 13:17:06
Whoops, lost the edit. Updated the comment in a la
| |
| 2189 const Instruction* instr = nullptr; | |
| 2188 const InstructionBlock::Predecessors& predecessors = block->predecessors(); | 2190 const InstructionBlock::Predecessors& predecessors = block->predecessors(); |
| 2189 const InstructionBlock* predecessor_block = | 2191 for (size_t i = 0; i < predecessors.size(); ++i) { |
| 2190 code()->InstructionBlockAt(predecessors[0]); | 2192 const InstructionBlock* predecessor_block = |
| 2191 const Instruction* instr = GetLastInstruction(code(), predecessor_block); | 2193 code()->InstructionBlockAt(predecessors[i]); |
| 2192 if (predecessor_block->IsDeferred()) { | 2194 if (predecessor_block->rpo_number() < block->rpo_number()) { |
| 2193 // "Prefer the hint from the first non-deferred predecessor, if any. | 2195 instr = GetLastInstruction(code(), predecessor_block); |
| 2194 for (size_t i = 1; i < predecessors.size(); ++i) { | 2196 if (!predecessor_block->IsDeferred()) break; |
|
Mircea Trofin
2016/06/01 15:02:58
Before, if the phi block was deferred, and all its
danno
2016/06/02 01:29:37
Hmmm. Sorry, perhaps I'm missing something here, b
Mircea Trofin
2016/06/02 01:39:51
Oh! You are right, sorry. I now see instr is alway
| |
| 2195 predecessor_block = code()->InstructionBlockAt(predecessors[i]); | |
| 2196 if (!predecessor_block->IsDeferred()) { | |
| 2197 instr = GetLastInstruction(code(), predecessor_block); | |
| 2198 break; | |
| 2199 } | |
| 2200 } | 2197 } |
| 2201 } | 2198 } |
| 2202 DCHECK_NOT_NULL(instr); | 2199 DCHECK_NOT_NULL(instr); |
| 2203 | 2200 |
| 2201 InstructionOperand* hint = nullptr; | |
| 2204 for (MoveOperands* move : *instr->GetParallelMove(Instruction::END)) { | 2202 for (MoveOperands* move : *instr->GetParallelMove(Instruction::END)) { |
| 2205 InstructionOperand& to = move->destination(); | 2203 InstructionOperand& to = move->destination(); |
| 2206 if (to.IsUnallocated() && | 2204 if (to.IsUnallocated() && |
| 2207 UnallocatedOperand::cast(to).virtual_register() == phi_vreg) { | 2205 UnallocatedOperand::cast(to).virtual_register() == phi_vreg) { |
| 2208 hint = &move->source(); | 2206 hint = &move->source(); |
| 2209 break; | 2207 break; |
| 2210 } | 2208 } |
| 2211 } | 2209 } |
| 2212 DCHECK(hint != nullptr); | 2210 DCHECK(hint != nullptr); |
| 2213 LifetimePosition block_start = LifetimePosition::GapFromInstructionIndex( | 2211 LifetimePosition block_start = LifetimePosition::GapFromInstructionIndex( |
| (...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3657 } | 3655 } |
| 3658 } | 3656 } |
| 3659 } | 3657 } |
| 3660 } | 3658 } |
| 3661 } | 3659 } |
| 3662 | 3660 |
| 3663 | 3661 |
| 3664 } // namespace compiler | 3662 } // namespace compiler |
| 3665 } // namespace internal | 3663 } // namespace internal |
| 3666 } // namespace v8 | 3664 } // namespace v8 |
| OLD | NEW |