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 3321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3332 FindResult result; | 3332 FindResult result; |
3333 const InstructionBlock* pred_block = code()->InstructionBlockAt(pred); | 3333 const InstructionBlock* pred_block = code()->InstructionBlockAt(pred); |
3334 if (!array->FindConnectableSubranges(block, pred_block, &result)) { | 3334 if (!array->FindConnectableSubranges(block, pred_block, &result)) { |
3335 continue; | 3335 continue; |
3336 } | 3336 } |
3337 InstructionOperand pred_op = result.pred_cover_->GetAssignedOperand(); | 3337 InstructionOperand pred_op = result.pred_cover_->GetAssignedOperand(); |
3338 InstructionOperand cur_op = result.cur_cover_->GetAssignedOperand(); | 3338 InstructionOperand cur_op = result.cur_cover_->GetAssignedOperand(); |
3339 if (pred_op.Equals(cur_op)) continue; | 3339 if (pred_op.Equals(cur_op)) continue; |
3340 if (!pred_op.IsAnyRegister() && cur_op.IsAnyRegister()) { | 3340 if (!pred_op.IsAnyRegister() && cur_op.IsAnyRegister()) { |
3341 // We're doing a reload. | 3341 // We're doing a reload. |
| 3342 // We don't need to, if: |
| 3343 // 1) there's no register use in this block, and |
| 3344 // 2) the range ends before the block does, and |
| 3345 // 3) we don't have a successor, or the successor is spilled. |
| 3346 LifetimePosition block_start = |
| 3347 LifetimePosition::GapFromInstructionIndex(block->code_start()); |
| 3348 LifetimePosition block_end = |
| 3349 LifetimePosition::GapFromInstructionIndex(block->code_end()); |
3342 const LiveRange* current = result.cur_cover_; | 3350 const LiveRange* current = result.cur_cover_; |
| 3351 const LiveRange* successor = current->next(); |
| 3352 if (current->End() < block_end && |
| 3353 (successor == nullptr || successor->spilled())) { |
| 3354 // verify point 1: no register use. We can go to the end of the |
| 3355 // range, since it's all within the block. |
3343 | 3356 |
| 3357 bool uses_reg = false; |
| 3358 for (const UsePosition* use = current->NextUsePosition(block_start); |
| 3359 use != nullptr; use = use->next()) { |
| 3360 if (use->operand()->IsAnyRegister()) { |
| 3361 uses_reg = true; |
| 3362 break; |
| 3363 } |
| 3364 } |
| 3365 if (!uses_reg) continue; |
| 3366 } |
3344 if (current->TopLevel()->IsSpilledOnlyInDeferredBlocks() && | 3367 if (current->TopLevel()->IsSpilledOnlyInDeferredBlocks() && |
3345 pred_block->IsDeferred()) { | 3368 pred_block->IsDeferred()) { |
3346 // The spill location should be defined in pred_block, so add | 3369 // The spill location should be defined in pred_block, so add |
3347 // pred_block to the list of blocks requiring a spill operand. | 3370 // pred_block to the list of blocks requiring a spill operand. |
3348 current->TopLevel()->GetListOfBlocksRequiringSpillOperands()->Add( | 3371 current->TopLevel()->GetListOfBlocksRequiringSpillOperands()->Add( |
3349 pred_block->rpo_number().ToInt()); | 3372 pred_block->rpo_number().ToInt()); |
3350 } | 3373 } |
3351 } | 3374 } |
3352 int move_loc = ResolveControlFlow(block, cur_op, pred_block, pred_op); | 3375 int move_loc = ResolveControlFlow(block, cur_op, pred_block, pred_op); |
3353 USE(move_loc); | 3376 USE(move_loc); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3552 spill_operand); | 3575 spill_operand); |
3553 } | 3576 } |
3554 } | 3577 } |
3555 } | 3578 } |
3556 } | 3579 } |
3557 | 3580 |
3558 | 3581 |
3559 } // namespace compiler | 3582 } // namespace compiler |
3560 } // namespace internal | 3583 } // namespace internal |
3561 } // namespace v8 | 3584 } // namespace v8 |
OLD | NEW |