| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 400 |
| 401 | 401 |
| 402 class GraphC1Visualizer { | 402 class GraphC1Visualizer { |
| 403 public: | 403 public: |
| 404 GraphC1Visualizer(std::ostream& os, Zone* zone); // NOLINT | 404 GraphC1Visualizer(std::ostream& os, Zone* zone); // NOLINT |
| 405 | 405 |
| 406 void PrintCompilation(const CompilationInfo* info); | 406 void PrintCompilation(const CompilationInfo* info); |
| 407 void PrintSchedule(const char* phase, const Schedule* schedule, | 407 void PrintSchedule(const char* phase, const Schedule* schedule, |
| 408 const SourcePositionTable* positions, | 408 const SourcePositionTable* positions, |
| 409 const InstructionSequence* instructions); | 409 const InstructionSequence* instructions); |
| 410 void PrintAllocator(const char* phase, const RegisterAllocator* allocator); | 410 void PrintLiveRanges(const char* phase, const RegisterAllocationData* data); |
| 411 Zone* zone() const { return zone_; } | 411 Zone* zone() const { return zone_; } |
| 412 | 412 |
| 413 private: | 413 private: |
| 414 void PrintIndent(); | 414 void PrintIndent(); |
| 415 void PrintStringProperty(const char* name, const char* value); | 415 void PrintStringProperty(const char* name, const char* value); |
| 416 void PrintLongProperty(const char* name, int64_t value); | 416 void PrintLongProperty(const char* name, int64_t value); |
| 417 void PrintIntProperty(const char* name, int value); | 417 void PrintIntProperty(const char* name, int value); |
| 418 void PrintBlockProperty(const char* name, int rpo_number); | 418 void PrintBlockProperty(const char* name, int rpo_number); |
| 419 void PrintNodeId(Node* n); | 419 void PrintNodeId(Node* n); |
| 420 void PrintNode(Node* n); | 420 void PrintNode(Node* n); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 PrintIndent(); | 686 PrintIndent(); |
| 687 PrintableInstruction printable = {RegisterConfiguration::ArchDefault(), | 687 PrintableInstruction printable = {RegisterConfiguration::ArchDefault(), |
| 688 instructions->InstructionAt(j)}; | 688 instructions->InstructionAt(j)}; |
| 689 os_ << j << " " << printable << " <|@\n"; | 689 os_ << j << " " << printable << " <|@\n"; |
| 690 } | 690 } |
| 691 } | 691 } |
| 692 } | 692 } |
| 693 } | 693 } |
| 694 | 694 |
| 695 | 695 |
| 696 void GraphC1Visualizer::PrintAllocator(const char* phase, | 696 void GraphC1Visualizer::PrintLiveRanges(const char* phase, |
| 697 const RegisterAllocator* allocator) { | 697 const RegisterAllocationData* data) { |
| 698 Tag tag(this, "intervals"); | 698 Tag tag(this, "intervals"); |
| 699 PrintStringProperty("name", phase); | 699 PrintStringProperty("name", phase); |
| 700 | 700 |
| 701 for (auto range : allocator->fixed_double_live_ranges()) { | 701 for (auto range : data->fixed_double_live_ranges()) { |
| 702 PrintLiveRange(range, "fixed"); | 702 PrintLiveRange(range, "fixed"); |
| 703 } | 703 } |
| 704 | 704 |
| 705 for (auto range : allocator->fixed_live_ranges()) { | 705 for (auto range : data->fixed_live_ranges()) { |
| 706 PrintLiveRange(range, "fixed"); | 706 PrintLiveRange(range, "fixed"); |
| 707 } | 707 } |
| 708 | 708 |
| 709 for (auto range : allocator->live_ranges()) { | 709 for (auto range : data->live_ranges()) { |
| 710 PrintLiveRange(range, "object"); | 710 PrintLiveRange(range, "object"); |
| 711 } | 711 } |
| 712 } | 712 } |
| 713 | 713 |
| 714 | 714 |
| 715 void GraphC1Visualizer::PrintLiveRange(LiveRange* range, const char* type) { | 715 void GraphC1Visualizer::PrintLiveRange(LiveRange* range, const char* type) { |
| 716 if (range != NULL && !range->IsEmpty()) { | 716 if (range != NULL && !range->IsEmpty()) { |
| 717 PrintIndent(); | 717 PrintIndent(); |
| 718 os_ << range->id() << " " << type; | 718 os_ << range->id() << " " << type; |
| 719 if (range->HasRegisterAssigned()) { | 719 if (range->HasRegisterAssigned()) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 | 784 |
| 785 | 785 |
| 786 std::ostream& operator<<(std::ostream& os, const AsC1V& ac) { | 786 std::ostream& operator<<(std::ostream& os, const AsC1V& ac) { |
| 787 Zone tmp_zone; | 787 Zone tmp_zone; |
| 788 GraphC1Visualizer(os, &tmp_zone) | 788 GraphC1Visualizer(os, &tmp_zone) |
| 789 .PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_); | 789 .PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_); |
| 790 return os; | 790 return os; |
| 791 } | 791 } |
| 792 | 792 |
| 793 | 793 |
| 794 std::ostream& operator<<(std::ostream& os, const AsC1VAllocator& ac) { | 794 std::ostream& operator<<(std::ostream& os, |
| 795 const AsC1VRegisterAllocationData& ac) { |
| 795 Zone tmp_zone; | 796 Zone tmp_zone; |
| 796 GraphC1Visualizer(os, &tmp_zone).PrintAllocator(ac.phase_, ac.allocator_); | 797 GraphC1Visualizer(os, &tmp_zone).PrintLiveRanges(ac.phase_, ac.data_); |
| 797 return os; | 798 return os; |
| 798 } | 799 } |
| 799 | 800 |
| 800 const int kUnvisited = 0; | 801 const int kUnvisited = 0; |
| 801 const int kOnStack = 1; | 802 const int kOnStack = 1; |
| 802 const int kVisited = 2; | 803 const int kVisited = 2; |
| 803 | 804 |
| 804 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { | 805 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { |
| 805 Zone local_zone; | 806 Zone local_zone; |
| 806 ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone); | 807 ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 829 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); | 830 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
| 830 } | 831 } |
| 831 os << ")" << std::endl; | 832 os << ")" << std::endl; |
| 832 } | 833 } |
| 833 } | 834 } |
| 834 return os; | 835 return os; |
| 835 } | 836 } |
| 836 } | 837 } |
| 837 } | 838 } |
| 838 } // namespace v8::internal::compiler | 839 } // namespace v8::internal::compiler |
| OLD | NEW |