| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/compiler/graph-visualizer.h" | 5 #include "src/compiler/graph-visualizer.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 PrintLiveRange(range, "object"); | 701 PrintLiveRange(range, "object"); |
| 702 } | 702 } |
| 703 } | 703 } |
| 704 | 704 |
| 705 | 705 |
| 706 void GraphC1Visualizer::PrintLiveRange(LiveRange* range, const char* type) { | 706 void GraphC1Visualizer::PrintLiveRange(LiveRange* range, const char* type) { |
| 707 if (range != NULL && !range->IsEmpty()) { | 707 if (range != NULL && !range->IsEmpty()) { |
| 708 PrintIndent(); | 708 PrintIndent(); |
| 709 os_ << range->id() << " " << type; | 709 os_ << range->id() << " " << type; |
| 710 if (range->HasRegisterAssigned()) { | 710 if (range->HasRegisterAssigned()) { |
| 711 InstructionOperand op = range->GetAssignedOperand(); | 711 AllocatedOperand op = AllocatedOperand::cast(range->GetAssignedOperand()); |
| 712 int assigned_reg = op.index(); | 712 int assigned_reg = op.index(); |
| 713 if (op.IsDoubleRegister()) { | 713 if (op.IsDoubleRegister()) { |
| 714 os_ << " \"" << DoubleRegister::AllocationIndexToString(assigned_reg) | 714 os_ << " \"" << DoubleRegister::AllocationIndexToString(assigned_reg) |
| 715 << "\""; | 715 << "\""; |
| 716 } else { | 716 } else { |
| 717 DCHECK(op.IsRegister()); | 717 DCHECK(op.IsRegister()); |
| 718 os_ << " \"" << Register::AllocationIndexToString(assigned_reg) << "\""; | 718 os_ << " \"" << Register::AllocationIndexToString(assigned_reg) << "\""; |
| 719 } | 719 } |
| 720 } else if (range->IsSpilled()) { | 720 } else if (range->IsSpilled()) { |
| 721 auto top = range->TopLevel(); |
| 721 int index = -1; | 722 int index = -1; |
| 722 if (range->TopLevel()->HasSpillRange()) { | 723 if (top->HasSpillRange()) { |
| 723 index = kMaxInt; // This hasn't been set yet. | 724 index = kMaxInt; // This hasn't been set yet. |
| 725 } else if (top->GetSpillOperand()->IsConstant()) { |
| 726 os_ << " \"const(nostack):" |
| 727 << ConstantOperand::cast(top->GetSpillOperand())->virtual_register() |
| 728 << "\""; |
| 724 } else { | 729 } else { |
| 725 index = range->TopLevel()->GetSpillOperand()->index(); | 730 index = AllocatedOperand::cast(top->GetSpillOperand())->index(); |
| 726 } | 731 if (top->Kind() == DOUBLE_REGISTERS) { |
| 727 if (range->TopLevel()->Kind() == DOUBLE_REGISTERS) { | 732 os_ << " \"double_stack:" << index << "\""; |
| 728 os_ << " \"double_stack:" << index << "\""; | 733 } else if (top->Kind() == GENERAL_REGISTERS) { |
| 729 } else if (range->TopLevel()->Kind() == GENERAL_REGISTERS) { | 734 os_ << " \"stack:" << index << "\""; |
| 730 os_ << " \"stack:" << index << "\""; | 735 } |
| 731 } else { | |
| 732 os_ << " \"const(nostack):" << index << "\""; | |
| 733 } | 736 } |
| 734 } | 737 } |
| 735 int parent_index = -1; | 738 int parent_index = -1; |
| 736 if (range->IsChild()) { | 739 if (range->IsChild()) { |
| 737 parent_index = range->parent()->id(); | 740 parent_index = range->parent()->id(); |
| 738 } else { | 741 } else { |
| 739 parent_index = range->id(); | 742 parent_index = range->id(); |
| 740 } | 743 } |
| 741 InstructionOperand* op = range->FirstHint(); | 744 InstructionOperand* op = range->FirstHint(); |
| 742 int hint_index = -1; | 745 int hint_index = -1; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); | 820 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
| 818 } | 821 } |
| 819 os << ")" << std::endl; | 822 os << ")" << std::endl; |
| 820 } | 823 } |
| 821 } | 824 } |
| 822 return os; | 825 return os; |
| 823 } | 826 } |
| 824 } | 827 } |
| 825 } | 828 } |
| 826 } // namespace v8::internal::compiler | 829 } // namespace v8::internal::compiler |
| OLD | NEW |