Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: src/compiler/register-allocator.cc

Issue 1810333003: [turbofan] Move frame elision logic to the end (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 3155
3156 SpillSlotLocator::SpillSlotLocator(RegisterAllocationData* data) 3156 SpillSlotLocator::SpillSlotLocator(RegisterAllocationData* data)
3157 : data_(data) {} 3157 : data_(data) {}
3158 3158
3159 3159
3160 void SpillSlotLocator::LocateSpillSlots() { 3160 void SpillSlotLocator::LocateSpillSlots() {
3161 const InstructionSequence* code = data()->code(); 3161 const InstructionSequence* code = data()->code();
3162 for (TopLevelLiveRange* range : data()->live_ranges()) { 3162 for (TopLevelLiveRange* range : data()->live_ranges()) {
3163 if (range == nullptr || range->IsEmpty()) continue; 3163 if (range == nullptr || range->IsEmpty()) continue;
3164 // We care only about ranges which spill in the frame. 3164 // We care only about ranges which spill in the frame.
3165 if (!range->HasSpillRange()) continue; 3165 if (!range->HasSpillRange() || range->IsSpilledOnlyInDeferredBlocks()) {
3166 if (range->IsSpilledOnlyInDeferredBlocks()) { 3166 continue;
3167 for (LiveRange* child = range; child != nullptr; child = child->next()) { 3167 }
3168 if (child->spilled()) { 3168 TopLevelLiveRange::SpillMoveInsertionList* spills =
3169 code->GetInstructionBlock(child->Start().ToInstructionIndex()) 3169 range->GetSpillMoveInsertionLocations();
3170 ->mark_needs_frame(); 3170 DCHECK_NOT_NULL(spills);
3171 } 3171 for (; spills != nullptr; spills = spills->next) {
3172 } 3172 code->GetInstructionBlock(spills->gap_index)->mark_needs_frame();
3173 } else {
3174 TopLevelLiveRange::SpillMoveInsertionList* spills =
3175 range->GetSpillMoveInsertionLocations();
3176 DCHECK_NOT_NULL(spills);
3177 for (; spills != nullptr; spills = spills->next) {
3178 code->GetInstructionBlock(spills->gap_index)->mark_needs_frame();
3179 }
3180 } 3173 }
3181 } 3174 }
3182 } 3175 }
3183 3176
3184 3177
3185 OperandAssigner::OperandAssigner(RegisterAllocationData* data) : data_(data) {} 3178 OperandAssigner::OperandAssigner(RegisterAllocationData* data) : data_(data) {}
3186 3179
3187 3180
3188 void OperandAssigner::AssignSpillSlots() { 3181 void OperandAssigner::AssignSpillSlots() {
3189 ZoneVector<SpillRange*>& spill_ranges = data()->spill_ranges(); 3182 ZoneVector<SpillRange*>& spill_ranges = data()->spill_ranges();
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 3625
3633 // Seek the deferred blocks that dominate locations requiring spill operands, 3626 // Seek the deferred blocks that dominate locations requiring spill operands,
3634 // and spill there. We only need to spill at the start of such blocks. 3627 // and spill there. We only need to spill at the start of such blocks.
3635 BitVector done_blocks( 3628 BitVector done_blocks(
3636 range->GetListOfBlocksRequiringSpillOperands()->length(), temp_zone); 3629 range->GetListOfBlocksRequiringSpillOperands()->length(), temp_zone);
3637 while (!worklist.empty()) { 3630 while (!worklist.empty()) {
3638 int block_id = worklist.front(); 3631 int block_id = worklist.front();
3639 worklist.pop(); 3632 worklist.pop();
3640 if (done_blocks.Contains(block_id)) continue; 3633 if (done_blocks.Contains(block_id)) continue;
3641 done_blocks.Add(block_id); 3634 done_blocks.Add(block_id);
3642 const InstructionBlock* spill_block = 3635 InstructionBlock* spill_block =
3643 code->InstructionBlockAt(RpoNumber::FromInt(block_id)); 3636 code->InstructionBlockAt(RpoNumber::FromInt(block_id));
3644 3637
3645 for (const RpoNumber& pred : spill_block->predecessors()) { 3638 for (const RpoNumber& pred : spill_block->predecessors()) {
3646 const InstructionBlock* pred_block = code->InstructionBlockAt(pred); 3639 const InstructionBlock* pred_block = code->InstructionBlockAt(pred);
3647 3640
3648 if (pred_block->IsDeferred()) { 3641 if (pred_block->IsDeferred()) {
3649 worklist.push(pred_block->rpo_number().ToInt()); 3642 worklist.push(pred_block->rpo_number().ToInt());
3650 } else { 3643 } else {
3651 LifetimePosition pred_end = 3644 LifetimePosition pred_end =
3652 LifetimePosition::InstructionFromInstructionIndex( 3645 LifetimePosition::InstructionFromInstructionIndex(
3653 pred_block->last_instruction_index()); 3646 pred_block->last_instruction_index());
3654 3647
3655 LiveRangeBound* bound = array->Find(pred_end); 3648 LiveRangeBound* bound = array->Find(pred_end);
3656 3649
3657 InstructionOperand pred_op = bound->range_->GetAssignedOperand(); 3650 InstructionOperand pred_op = bound->range_->GetAssignedOperand();
3658 3651
3659 data()->AddGapMove(spill_block->first_instruction_index(), 3652 data()->AddGapMove(spill_block->first_instruction_index(),
3660 Instruction::GapPosition::START, pred_op, 3653 Instruction::GapPosition::START, pred_op,
3661 spill_operand); 3654 spill_operand);
3655 spill_block->mark_needs_frame();
3662 } 3656 }
3663 } 3657 }
3664 } 3658 }
3665 } 3659 }
3666 3660
3667 3661
3668 } // namespace compiler 3662 } // namespace compiler
3669 } // namespace internal 3663 } // namespace internal
3670 } // namespace v8 3664 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698