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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 428 |
429 | 429 |
430 LiveRange* LiveRange::SplitAt(LifetimePosition position, Zone* zone) { | 430 LiveRange* LiveRange::SplitAt(LifetimePosition position, Zone* zone) { |
431 int new_id = TopLevel()->GetNextChildId(); | 431 int new_id = TopLevel()->GetNextChildId(); |
432 LiveRange* child = new (zone) LiveRange(new_id, representation(), TopLevel()); | 432 LiveRange* child = new (zone) LiveRange(new_id, representation(), TopLevel()); |
433 DetachAt(position, child, zone); | 433 DetachAt(position, child, zone); |
434 | 434 |
435 child->top_level_ = TopLevel(); | 435 child->top_level_ = TopLevel(); |
436 child->next_ = next_; | 436 child->next_ = next_; |
437 next_ = child; | 437 next_ = child; |
438 if (child->next() == nullptr) { | |
439 TopLevel()->set_last_child(child); | |
440 } | |
441 return child; | 438 return child; |
442 } | 439 } |
443 | 440 |
444 | 441 |
445 UsePosition* LiveRange::DetachAt(LifetimePosition position, LiveRange* result, | 442 UsePosition* LiveRange::DetachAt(LifetimePosition position, LiveRange* result, |
446 Zone* zone) { | 443 Zone* zone) { |
447 DCHECK(Start() < position); | 444 DCHECK(Start() < position); |
448 DCHECK(End() > position); | 445 DCHECK(End() > position); |
449 DCHECK(result->IsEmpty()); | 446 DCHECK(result->IsEmpty()); |
450 // Find the last interval that ends before the position. If the | 447 // Find the last interval that ends before the position. If the |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 size_ = kInvalidSize; | 524 size_ = kInvalidSize; |
528 weight_ = kInvalidWeight; | 525 weight_ = kInvalidWeight; |
529 #ifdef DEBUG | 526 #ifdef DEBUG |
530 Verify(); | 527 Verify(); |
531 result->Verify(); | 528 result->Verify(); |
532 #endif | 529 #endif |
533 return use_before; | 530 return use_before; |
534 } | 531 } |
535 | 532 |
536 | 533 |
537 void LiveRange::AppendAsChild(TopLevelLiveRange* other) { | |
538 next_ = other; | |
539 | |
540 other->UpdateParentForAllChildren(TopLevel()); | |
541 TopLevel()->UpdateSpillRangePostMerge(other); | |
542 TopLevel()->set_last_child(other->last_child()); | |
543 } | |
544 | |
545 | |
546 void LiveRange::UpdateParentForAllChildren(TopLevelLiveRange* new_top_level) { | 534 void LiveRange::UpdateParentForAllChildren(TopLevelLiveRange* new_top_level) { |
547 LiveRange* child = this; | 535 LiveRange* child = this; |
548 for (; child != nullptr; child = child->next()) { | 536 for (; child != nullptr; child = child->next()) { |
549 child->top_level_ = new_top_level; | 537 child->top_level_ = new_top_level; |
550 } | 538 } |
551 } | 539 } |
552 | 540 |
553 | 541 |
554 void LiveRange::ConvertUsesToOperand(const InstructionOperand& op, | 542 void LiveRange::ConvertUsesToOperand(const InstructionOperand& op, |
555 const InstructionOperand& spill_op) { | 543 const InstructionOperand& spill_op) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 664 |
677 TopLevelLiveRange::TopLevelLiveRange(int vreg, MachineRepresentation rep) | 665 TopLevelLiveRange::TopLevelLiveRange(int vreg, MachineRepresentation rep) |
678 : LiveRange(0, rep, this), | 666 : LiveRange(0, rep, this), |
679 vreg_(vreg), | 667 vreg_(vreg), |
680 last_child_id_(0), | 668 last_child_id_(0), |
681 splintered_from_(nullptr), | 669 splintered_from_(nullptr), |
682 spill_operand_(nullptr), | 670 spill_operand_(nullptr), |
683 spill_move_insertion_locations_(nullptr), | 671 spill_move_insertion_locations_(nullptr), |
684 spilled_in_deferred_blocks_(false), | 672 spilled_in_deferred_blocks_(false), |
685 spill_start_index_(kMaxInt), | 673 spill_start_index_(kMaxInt), |
686 last_child_(this), | |
687 last_pos_(nullptr), | 674 last_pos_(nullptr), |
688 splinter_(nullptr), | 675 splinter_(nullptr), |
689 has_preassigned_slot_(false) { | 676 has_preassigned_slot_(false) { |
690 bits_ |= SpillTypeField::encode(SpillType::kNoSpillType); | 677 bits_ |= SpillTypeField::encode(SpillType::kNoSpillType); |
691 } | 678 } |
692 | 679 |
693 | 680 |
694 #if DEBUG | 681 #if DEBUG |
695 int TopLevelLiveRange::debug_virt_reg() const { | 682 int TopLevelLiveRange::debug_virt_reg() const { |
696 return IsSplinter() ? splintered_from()->vreg() : vreg(); | 683 return IsSplinter() ? splintered_from()->vreg() : vreg(); |
(...skipping 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3449 auto eliminate = moves->PrepareInsertAfter(move); | 3436 auto eliminate = moves->PrepareInsertAfter(move); |
3450 to_insert.push_back(move); | 3437 to_insert.push_back(move); |
3451 if (eliminate != nullptr) to_eliminate.push_back(eliminate); | 3438 if (eliminate != nullptr) to_eliminate.push_back(eliminate); |
3452 } | 3439 } |
3453 } | 3440 } |
3454 | 3441 |
3455 | 3442 |
3456 } // namespace compiler | 3443 } // namespace compiler |
3457 } // namespace internal | 3444 } // namespace internal |
3458 } // namespace v8 | 3445 } // namespace v8 |
OLD | NEW |