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/compiler/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/instruction.h" | 7 #include "src/compiler/instruction.h" |
8 #include "src/compiler/schedule.h" | 8 #include "src/compiler/schedule.h" |
9 #include "src/compiler/state-values-utils.h" | 9 #include "src/compiler/state-values-utils.h" |
10 | 10 |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 os << wrapper << std::endl; | 812 os << wrapper << std::endl; |
813 } | 813 } |
814 | 814 |
815 | 815 |
816 void InstructionSequence::Print() const { | 816 void InstructionSequence::Print() const { |
817 const RegisterConfiguration* config = | 817 const RegisterConfiguration* config = |
818 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN); | 818 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN); |
819 Print(config); | 819 Print(config); |
820 } | 820 } |
821 | 821 |
| 822 void InstructionSequence::PrintBlock(const RegisterConfiguration* config, |
| 823 int block_id) const { |
| 824 OFStream os(stdout); |
| 825 RpoNumber rpo = RpoNumber::FromInt(block_id); |
| 826 const InstructionBlock* block = InstructionBlockAt(rpo); |
| 827 CHECK(block->rpo_number() == rpo); |
| 828 |
| 829 os << "B" << block->rpo_number(); |
| 830 os << ": AO#" << block->ao_number(); |
| 831 if (block->IsDeferred()) os << " (deferred)"; |
| 832 if (!block->needs_frame()) os << " (no frame)"; |
| 833 if (block->must_construct_frame()) os << " (construct frame)"; |
| 834 if (block->must_deconstruct_frame()) os << " (deconstruct frame)"; |
| 835 if (block->IsLoopHeader()) { |
| 836 os << " loop blocks: [" << block->rpo_number() << ", " << block->loop_end() |
| 837 << ")"; |
| 838 } |
| 839 os << " instructions: [" << block->code_start() << ", " << block->code_end() |
| 840 << ")\n predecessors:"; |
| 841 |
| 842 for (auto pred : block->predecessors()) { |
| 843 os << " B" << pred.ToInt(); |
| 844 } |
| 845 os << "\n"; |
| 846 |
| 847 for (auto phi : block->phis()) { |
| 848 PrintableInstructionOperand printable_op = {config, phi->output()}; |
| 849 os << " phi: " << printable_op << " ="; |
| 850 for (auto input : phi->operands()) { |
| 851 os << " v" << input; |
| 852 } |
| 853 os << "\n"; |
| 854 } |
| 855 |
| 856 ScopedVector<char> buf(32); |
| 857 PrintableInstruction printable_instr; |
| 858 printable_instr.register_configuration_ = config; |
| 859 for (int j = block->first_instruction_index(); |
| 860 j <= block->last_instruction_index(); j++) { |
| 861 // TODO(svenpanne) Add some basic formatting to our streams. |
| 862 SNPrintF(buf, "%5d", j); |
| 863 printable_instr.instr_ = InstructionAt(j); |
| 864 os << " " << buf.start() << ": " << printable_instr << "\n"; |
| 865 } |
| 866 |
| 867 for (auto succ : block->successors()) { |
| 868 os << " B" << succ.ToInt(); |
| 869 } |
| 870 os << "\n"; |
| 871 } |
| 872 |
| 873 void InstructionSequence::PrintBlock(int block_id) const { |
| 874 const RegisterConfiguration* config = |
| 875 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN); |
| 876 PrintBlock(config, block_id); |
| 877 } |
822 | 878 |
823 FrameStateDescriptor::FrameStateDescriptor( | 879 FrameStateDescriptor::FrameStateDescriptor( |
824 Zone* zone, FrameStateType type, BailoutId bailout_id, | 880 Zone* zone, FrameStateType type, BailoutId bailout_id, |
825 OutputFrameStateCombine state_combine, size_t parameters_count, | 881 OutputFrameStateCombine state_combine, size_t parameters_count, |
826 size_t locals_count, size_t stack_count, | 882 size_t locals_count, size_t stack_count, |
827 MaybeHandle<SharedFunctionInfo> shared_info, | 883 MaybeHandle<SharedFunctionInfo> shared_info, |
828 FrameStateDescriptor* outer_state) | 884 FrameStateDescriptor* outer_state) |
829 : type_(type), | 885 : type_(type), |
830 bailout_id_(bailout_id), | 886 bailout_id_(bailout_id), |
831 frame_state_combine_(state_combine), | 887 frame_state_combine_(state_combine), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 for (size_t i = 0; i < code.immediates_.size(); ++i) { | 950 for (size_t i = 0; i < code.immediates_.size(); ++i) { |
895 Constant constant = code.immediates_[i]; | 951 Constant constant = code.immediates_[i]; |
896 os << "IMM#" << i << ": " << constant << "\n"; | 952 os << "IMM#" << i << ": " << constant << "\n"; |
897 } | 953 } |
898 int i = 0; | 954 int i = 0; |
899 for (ConstantMap::const_iterator it = code.constants_.begin(); | 955 for (ConstantMap::const_iterator it = code.constants_.begin(); |
900 it != code.constants_.end(); ++i, ++it) { | 956 it != code.constants_.end(); ++i, ++it) { |
901 os << "CST#" << i << ": v" << it->first << " = " << it->second << "\n"; | 957 os << "CST#" << i << ": v" << it->first << " = " << it->second << "\n"; |
902 } | 958 } |
903 for (int i = 0; i < code.InstructionBlockCount(); i++) { | 959 for (int i = 0; i < code.InstructionBlockCount(); i++) { |
904 RpoNumber rpo = RpoNumber::FromInt(i); | 960 printable.sequence_->PrintBlock(printable.register_configuration_, i); |
905 const InstructionBlock* block = code.InstructionBlockAt(rpo); | |
906 CHECK(block->rpo_number() == rpo); | |
907 | |
908 os << "B" << block->rpo_number(); | |
909 os << ": AO#" << block->ao_number(); | |
910 if (block->IsDeferred()) os << " (deferred)"; | |
911 if (!block->needs_frame()) os << " (no frame)"; | |
912 if (block->must_construct_frame()) os << " (construct frame)"; | |
913 if (block->must_deconstruct_frame()) os << " (deconstruct frame)"; | |
914 if (block->IsLoopHeader()) { | |
915 os << " loop blocks: [" << block->rpo_number() << ", " | |
916 << block->loop_end() << ")"; | |
917 } | |
918 os << " instructions: [" << block->code_start() << ", " | |
919 << block->code_end() << ")\n predecessors:"; | |
920 | |
921 for (auto pred : block->predecessors()) { | |
922 os << " B" << pred.ToInt(); | |
923 } | |
924 os << "\n"; | |
925 | |
926 for (auto phi : block->phis()) { | |
927 PrintableInstructionOperand printable_op = { | |
928 printable.register_configuration_, phi->output()}; | |
929 os << " phi: " << printable_op << " ="; | |
930 for (auto input : phi->operands()) { | |
931 os << " v" << input; | |
932 } | |
933 os << "\n"; | |
934 } | |
935 | |
936 ScopedVector<char> buf(32); | |
937 PrintableInstruction printable_instr; | |
938 printable_instr.register_configuration_ = printable.register_configuration_; | |
939 for (int j = block->first_instruction_index(); | |
940 j <= block->last_instruction_index(); j++) { | |
941 // TODO(svenpanne) Add some basic formatting to our streams. | |
942 SNPrintF(buf, "%5d", j); | |
943 printable_instr.instr_ = code.InstructionAt(j); | |
944 os << " " << buf.start() << ": " << printable_instr << "\n"; | |
945 } | |
946 | |
947 for (auto succ : block->successors()) { | |
948 os << " B" << succ.ToInt(); | |
949 } | |
950 os << "\n"; | |
951 } | 961 } |
952 return os; | 962 return os; |
953 } | 963 } |
954 | 964 |
955 } // namespace compiler | 965 } // namespace compiler |
956 } // namespace internal | 966 } // namespace internal |
957 } // namespace v8 | 967 } // namespace v8 |
OLD | NEW |