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

Side by Side Diff: src/compiler/graph-visualizer.cc

Issue 1094063002: [turbofan] split register allocator into little pieces (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
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
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,
411 const LiveRangeBuilder* live_range_builder);
411 Zone* zone() const { return zone_; } 412 Zone* zone() const { return zone_; }
412 413
413 private: 414 private:
414 void PrintIndent(); 415 void PrintIndent();
415 void PrintStringProperty(const char* name, const char* value); 416 void PrintStringProperty(const char* name, const char* value);
416 void PrintLongProperty(const char* name, int64_t value); 417 void PrintLongProperty(const char* name, int64_t value);
417 void PrintIntProperty(const char* name, int value); 418 void PrintIntProperty(const char* name, int value);
418 void PrintBlockProperty(const char* name, int rpo_number); 419 void PrintBlockProperty(const char* name, int rpo_number);
419 void PrintNodeId(Node* n); 420 void PrintNodeId(Node* n);
420 void PrintNode(Node* n); 421 void PrintNode(Node* n);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 PrintIndent(); 687 PrintIndent();
687 PrintableInstruction printable = {RegisterConfiguration::ArchDefault(), 688 PrintableInstruction printable = {RegisterConfiguration::ArchDefault(),
688 instructions->InstructionAt(j)}; 689 instructions->InstructionAt(j)};
689 os_ << j << " " << printable << " <|@\n"; 690 os_ << j << " " << printable << " <|@\n";
690 } 691 }
691 } 692 }
692 } 693 }
693 } 694 }
694 695
695 696
696 void GraphC1Visualizer::PrintAllocator(const char* phase, 697 void GraphC1Visualizer::PrintLiveRanges(
697 const RegisterAllocator* allocator) { 698 const char* phase, const LiveRangeBuilder* live_range_builder) {
698 Tag tag(this, "intervals"); 699 Tag tag(this, "intervals");
699 PrintStringProperty("name", phase); 700 PrintStringProperty("name", phase);
700 701
701 for (auto range : allocator->fixed_double_live_ranges()) { 702 for (auto range : live_range_builder->fixed_double_live_ranges()) {
702 PrintLiveRange(range, "fixed"); 703 PrintLiveRange(range, "fixed");
703 } 704 }
704 705
705 for (auto range : allocator->fixed_live_ranges()) { 706 for (auto range : live_range_builder->fixed_live_ranges()) {
706 PrintLiveRange(range, "fixed"); 707 PrintLiveRange(range, "fixed");
707 } 708 }
708 709
709 for (auto range : allocator->live_ranges()) { 710 for (auto range : live_range_builder->live_ranges()) {
710 PrintLiveRange(range, "object"); 711 PrintLiveRange(range, "object");
711 } 712 }
712 } 713 }
713 714
714 715
715 void GraphC1Visualizer::PrintLiveRange(LiveRange* range, const char* type) { 716 void GraphC1Visualizer::PrintLiveRange(LiveRange* range, const char* type) {
716 if (range != NULL && !range->IsEmpty()) { 717 if (range != NULL && !range->IsEmpty()) {
717 PrintIndent(); 718 PrintIndent();
718 os_ << range->id() << " " << type; 719 os_ << range->id() << " " << type;
719 if (range->HasRegisterAssigned()) { 720 if (range->HasRegisterAssigned()) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 785
785 786
786 std::ostream& operator<<(std::ostream& os, const AsC1V& ac) { 787 std::ostream& operator<<(std::ostream& os, const AsC1V& ac) {
787 Zone tmp_zone; 788 Zone tmp_zone;
788 GraphC1Visualizer(os, &tmp_zone) 789 GraphC1Visualizer(os, &tmp_zone)
789 .PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_); 790 .PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_);
790 return os; 791 return os;
791 } 792 }
792 793
793 794
794 std::ostream& operator<<(std::ostream& os, const AsC1VAllocator& ac) { 795 std::ostream& operator<<(std::ostream& os, const AsC1VLiveRangeBuilder& ac) {
795 Zone tmp_zone; 796 Zone tmp_zone;
796 GraphC1Visualizer(os, &tmp_zone).PrintAllocator(ac.phase_, ac.allocator_); 797 GraphC1Visualizer(os, &tmp_zone)
798 .PrintLiveRanges(ac.phase_, ac.live_range_builder_);
797 return os; 799 return os;
798 } 800 }
799 801
800 const int kUnvisited = 0; 802 const int kUnvisited = 0;
801 const int kOnStack = 1; 803 const int kOnStack = 1;
802 const int kVisited = 2; 804 const int kVisited = 2;
803 805
804 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { 806 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) {
805 Zone local_zone; 807 Zone local_zone;
806 ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone); 808 ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone);
(...skipping 22 matching lines...) Expand all
829 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); 831 os << "#" << SafeId(i) << ":" << SafeMnemonic(i);
830 } 832 }
831 os << ")" << std::endl; 833 os << ")" << std::endl;
832 } 834 }
833 } 835 }
834 return os; 836 return os;
835 } 837 }
836 } 838 }
837 } 839 }
838 } // namespace v8::internal::compiler 840 } // namespace v8::internal::compiler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698