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

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

Issue 951553005: [turbofan] remove dependence of InstructionBlock on BasicBlock (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/code-generator-impl.h ('k') | src/compiler/ia32/code-generator-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 const SourcePositionTable* positions, 399 const SourcePositionTable* positions,
400 const InstructionSequence* instructions); 400 const InstructionSequence* instructions);
401 void PrintAllocator(const char* phase, const RegisterAllocator* allocator); 401 void PrintAllocator(const char* phase, const RegisterAllocator* allocator);
402 Zone* zone() const { return zone_; } 402 Zone* zone() const { return zone_; }
403 403
404 private: 404 private:
405 void PrintIndent(); 405 void PrintIndent();
406 void PrintStringProperty(const char* name, const char* value); 406 void PrintStringProperty(const char* name, const char* value);
407 void PrintLongProperty(const char* name, int64_t value); 407 void PrintLongProperty(const char* name, int64_t value);
408 void PrintIntProperty(const char* name, int value); 408 void PrintIntProperty(const char* name, int value);
409 void PrintBlockProperty(const char* name, BasicBlock::Id block_id); 409 void PrintBlockProperty(const char* name, int rpo_number);
410 void PrintNodeId(Node* n); 410 void PrintNodeId(Node* n);
411 void PrintNode(Node* n); 411 void PrintNode(Node* n);
412 void PrintInputs(Node* n); 412 void PrintInputs(Node* n);
413 template <typename InputIterator> 413 template <typename InputIterator>
414 void PrintInputs(InputIterator* i, int count, const char* prefix); 414 void PrintInputs(InputIterator* i, int count, const char* prefix);
415 void PrintType(Node* node); 415 void PrintType(Node* node);
416 416
417 void PrintLiveRange(LiveRange* range, const char* type); 417 void PrintLiveRange(LiveRange* range, const char* type);
418 class Tag FINAL BASE_EMBEDDED { 418 class Tag FINAL BASE_EMBEDDED {
419 public: 419 public:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 os_ << name << " \"" << value << "\"\n"; 462 os_ << name << " \"" << value << "\"\n";
463 } 463 }
464 464
465 465
466 void GraphC1Visualizer::PrintLongProperty(const char* name, int64_t value) { 466 void GraphC1Visualizer::PrintLongProperty(const char* name, int64_t value) {
467 PrintIndent(); 467 PrintIndent();
468 os_ << name << " " << static_cast<int>(value / 1000) << "\n"; 468 os_ << name << " " << static_cast<int>(value / 1000) << "\n";
469 } 469 }
470 470
471 471
472 void GraphC1Visualizer::PrintBlockProperty(const char* name, 472 void GraphC1Visualizer::PrintBlockProperty(const char* name, int rpo_number) {
473 BasicBlock::Id block_id) {
474 PrintIndent(); 473 PrintIndent();
475 os_ << name << " \"B" << block_id << "\"\n"; 474 os_ << name << " \"B" << rpo_number << "\"\n";
476 } 475 }
477 476
478 477
479 void GraphC1Visualizer::PrintIntProperty(const char* name, int value) { 478 void GraphC1Visualizer::PrintIntProperty(const char* name, int value) {
480 PrintIndent(); 479 PrintIndent();
481 os_ << name << " " << value << "\n"; 480 os_ << name << " " << value << "\n";
482 } 481 }
483 482
484 483
485 void GraphC1Visualizer::PrintCompilation(const CompilationInfo* info) { 484 void GraphC1Visualizer::PrintCompilation(const CompilationInfo* info) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 void GraphC1Visualizer::PrintSchedule(const char* phase, 550 void GraphC1Visualizer::PrintSchedule(const char* phase,
552 const Schedule* schedule, 551 const Schedule* schedule,
553 const SourcePositionTable* positions, 552 const SourcePositionTable* positions,
554 const InstructionSequence* instructions) { 553 const InstructionSequence* instructions) {
555 Tag tag(this, "cfg"); 554 Tag tag(this, "cfg");
556 PrintStringProperty("name", phase); 555 PrintStringProperty("name", phase);
557 const BasicBlockVector* rpo = schedule->rpo_order(); 556 const BasicBlockVector* rpo = schedule->rpo_order();
558 for (size_t i = 0; i < rpo->size(); i++) { 557 for (size_t i = 0; i < rpo->size(); i++) {
559 BasicBlock* current = (*rpo)[i]; 558 BasicBlock* current = (*rpo)[i];
560 Tag block_tag(this, "block"); 559 Tag block_tag(this, "block");
561 PrintBlockProperty("name", current->id()); 560 PrintBlockProperty("name", current->rpo_number());
562 PrintIntProperty("from_bci", -1); 561 PrintIntProperty("from_bci", -1);
563 PrintIntProperty("to_bci", -1); 562 PrintIntProperty("to_bci", -1);
564 563
565 PrintIndent(); 564 PrintIndent();
566 os_ << "predecessors"; 565 os_ << "predecessors";
567 for (BasicBlock* predecessor : current->predecessors()) { 566 for (BasicBlock* predecessor : current->predecessors()) {
568 os_ << " \"B" << predecessor->id() << "\""; 567 os_ << " \"B" << predecessor->rpo_number() << "\"";
569 } 568 }
570 os_ << "\n"; 569 os_ << "\n";
571 570
572 PrintIndent(); 571 PrintIndent();
573 os_ << "successors"; 572 os_ << "successors";
574 for (BasicBlock* successor : current->successors()) { 573 for (BasicBlock* successor : current->successors()) {
575 os_ << " \"B" << successor->id() << "\""; 574 os_ << " \"B" << successor->rpo_number() << "\"";
576 } 575 }
577 os_ << "\n"; 576 os_ << "\n";
578 577
579 PrintIndent(); 578 PrintIndent();
580 os_ << "xhandlers\n"; 579 os_ << "xhandlers\n";
581 580
582 PrintIndent(); 581 PrintIndent();
583 os_ << "flags\n"; 582 os_ << "flags\n";
584 583
585 if (current->dominator() != NULL) { 584 if (current->dominator() != NULL) {
586 PrintBlockProperty("dominator", current->dominator()->id()); 585 PrintBlockProperty("dominator", current->dominator()->rpo_number());
587 } 586 }
588 587
589 PrintIntProperty("loop_depth", current->loop_depth()); 588 PrintIntProperty("loop_depth", current->loop_depth());
590 589
591 const InstructionBlock* instruction_block = 590 const InstructionBlock* instruction_block =
592 instructions->InstructionBlockAt(current->GetRpoNumber()); 591 instructions->InstructionBlockAt(
592 RpoNumber::FromInt(current->rpo_number()));
593 if (instruction_block->code_start() >= 0) { 593 if (instruction_block->code_start() >= 0) {
594 int first_index = instruction_block->first_instruction_index(); 594 int first_index = instruction_block->first_instruction_index();
595 int last_index = instruction_block->last_instruction_index(); 595 int last_index = instruction_block->last_instruction_index();
596 PrintIntProperty("first_lir_id", LifetimePosition::FromInstructionIndex( 596 PrintIntProperty("first_lir_id", LifetimePosition::FromInstructionIndex(
597 first_index).Value()); 597 first_index).Value());
598 PrintIntProperty("last_lir_id", LifetimePosition::FromInstructionIndex( 598 PrintIntProperty("last_lir_id", LifetimePosition::FromInstructionIndex(
599 last_index).Value()); 599 last_index).Value());
600 } 600 }
601 601
602 { 602 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 os_ << " <|@\n"; 647 os_ << " <|@\n";
648 } 648 }
649 649
650 BasicBlock::Control control = current->control(); 650 BasicBlock::Control control = current->control();
651 if (control != BasicBlock::kNone) { 651 if (control != BasicBlock::kNone) {
652 PrintIndent(); 652 PrintIndent();
653 os_ << "0 0 "; 653 os_ << "0 0 ";
654 if (current->control_input() != NULL) { 654 if (current->control_input() != NULL) {
655 PrintNode(current->control_input()); 655 PrintNode(current->control_input());
656 } else { 656 } else {
657 os_ << -1 - current->id().ToInt() << " Goto"; 657 os_ << -1 - current->rpo_number() << " Goto";
658 } 658 }
659 os_ << " ->"; 659 os_ << " ->";
660 for (BasicBlock* successor : current->successors()) { 660 for (BasicBlock* successor : current->successors()) {
661 os_ << " B" << successor->id(); 661 os_ << " B" << successor->rpo_number();
662 } 662 }
663 if (FLAG_trace_turbo_types && current->control_input() != NULL) { 663 if (FLAG_trace_turbo_types && current->control_input() != NULL) {
664 os_ << " "; 664 os_ << " ";
665 PrintType(current->control_input()); 665 PrintType(current->control_input());
666 } 666 }
667 os_ << " <|@\n"; 667 os_ << " <|@\n";
668 } 668 }
669 } 669 }
670 670
671 if (instructions != NULL) { 671 if (instructions != NULL) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); 815 os << "#" << SafeId(i) << ":" << SafeMnemonic(i);
816 } 816 }
817 os << ")" << std::endl; 817 os << ")" << std::endl;
818 } 818 }
819 } 819 }
820 return os; 820 return os;
821 } 821 }
822 } 822 }
823 } 823 }
824 } // namespace v8::internal::compiler 824 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/code-generator-impl.h ('k') | src/compiler/ia32/code-generator-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698