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 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 case kNotOverflow: | 52 case kNotOverflow: |
53 case kUnorderedEqual: | 53 case kUnorderedEqual: |
54 case kUnorderedNotEqual: | 54 case kUnorderedNotEqual: |
55 return condition; | 55 return condition; |
56 } | 56 } |
57 UNREACHABLE(); | 57 UNREACHABLE(); |
58 return condition; | 58 return condition; |
59 } | 59 } |
60 | 60 |
61 | 61 |
| 62 void InstructionOperand::Print(const RegisterConfiguration* config) const { |
| 63 OFStream os(stdout); |
| 64 PrintableInstructionOperand wrapper; |
| 65 wrapper.register_configuration_ = config; |
| 66 wrapper.op_ = *this; |
| 67 os << wrapper << std::endl; |
| 68 } |
| 69 |
| 70 |
| 71 void InstructionOperand::Print() const { |
| 72 const RegisterConfiguration* config = |
| 73 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN); |
| 74 Print(config); |
| 75 } |
| 76 |
| 77 |
62 std::ostream& operator<<(std::ostream& os, | 78 std::ostream& operator<<(std::ostream& os, |
63 const PrintableInstructionOperand& printable) { | 79 const PrintableInstructionOperand& printable) { |
64 const InstructionOperand& op = printable.op_; | 80 const InstructionOperand& op = printable.op_; |
65 const RegisterConfiguration* conf = printable.register_configuration_; | 81 const RegisterConfiguration* conf = printable.register_configuration_; |
66 switch (op.kind()) { | 82 switch (op.kind()) { |
67 case InstructionOperand::UNALLOCATED: { | 83 case InstructionOperand::UNALLOCATED: { |
68 const UnallocatedOperand* unalloc = UnallocatedOperand::cast(&op); | 84 const UnallocatedOperand* unalloc = UnallocatedOperand::cast(&op); |
69 os << "v" << unalloc->virtual_register(); | 85 os << "v" << unalloc->virtual_register(); |
70 if (unalloc->basic_policy() == UnallocatedOperand::FIXED_SLOT) { | 86 if (unalloc->basic_policy() == UnallocatedOperand::FIXED_SLOT) { |
71 return os << "(=" << unalloc->fixed_slot_index() << "S)"; | 87 return os << "(=" << unalloc->fixed_slot_index() << "S)"; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return os << "]"; | 161 return os << "]"; |
146 } | 162 } |
147 case InstructionOperand::INVALID: | 163 case InstructionOperand::INVALID: |
148 return os << "(x)"; | 164 return os << "(x)"; |
149 } | 165 } |
150 UNREACHABLE(); | 166 UNREACHABLE(); |
151 return os; | 167 return os; |
152 } | 168 } |
153 | 169 |
154 | 170 |
| 171 void MoveOperands::Print(const RegisterConfiguration* config) const { |
| 172 OFStream os(stdout); |
| 173 PrintableInstructionOperand wrapper; |
| 174 wrapper.register_configuration_ = config; |
| 175 wrapper.op_ = destination(); |
| 176 os << wrapper << " = "; |
| 177 wrapper.op_ = source(); |
| 178 os << wrapper << std::endl; |
| 179 } |
| 180 |
| 181 |
| 182 void MoveOperands::Print() const { |
| 183 const RegisterConfiguration* config = |
| 184 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN); |
| 185 Print(config); |
| 186 } |
| 187 |
| 188 |
155 std::ostream& operator<<(std::ostream& os, | 189 std::ostream& operator<<(std::ostream& os, |
156 const PrintableMoveOperands& printable) { | 190 const PrintableMoveOperands& printable) { |
157 const MoveOperands& mo = *printable.move_operands_; | 191 const MoveOperands& mo = *printable.move_operands_; |
158 PrintableInstructionOperand printable_op = {printable.register_configuration_, | 192 PrintableInstructionOperand printable_op = {printable.register_configuration_, |
159 mo.destination()}; | 193 mo.destination()}; |
160 os << printable_op; | 194 os << printable_op; |
161 if (!mo.source().Equals(mo.destination())) { | 195 if (!mo.source().Equals(mo.destination())) { |
162 printable_op.op_ = mo.source(); | 196 printable_op.op_ = mo.source(); |
163 os << " = " << printable_op; | 197 os << " = " << printable_op; |
164 } | 198 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 for (int i = Instruction::FIRST_GAP_POSITION; | 281 for (int i = Instruction::FIRST_GAP_POSITION; |
248 i <= Instruction::LAST_GAP_POSITION; i++) { | 282 i <= Instruction::LAST_GAP_POSITION; i++) { |
249 if (parallel_moves_[i] != nullptr && !parallel_moves_[i]->IsRedundant()) { | 283 if (parallel_moves_[i] != nullptr && !parallel_moves_[i]->IsRedundant()) { |
250 return false; | 284 return false; |
251 } | 285 } |
252 } | 286 } |
253 return true; | 287 return true; |
254 } | 288 } |
255 | 289 |
256 | 290 |
| 291 void Instruction::Print(const RegisterConfiguration* config) const { |
| 292 OFStream os(stdout); |
| 293 PrintableInstruction wrapper; |
| 294 wrapper.instr_ = this; |
| 295 wrapper.register_configuration_ = config; |
| 296 os << wrapper << std::endl; |
| 297 } |
| 298 |
| 299 |
| 300 void Instruction::Print() const { |
| 301 const RegisterConfiguration* config = |
| 302 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN); |
| 303 Print(config); |
| 304 } |
| 305 |
| 306 |
257 std::ostream& operator<<(std::ostream& os, | 307 std::ostream& operator<<(std::ostream& os, |
258 const PrintableParallelMove& printable) { | 308 const PrintableParallelMove& printable) { |
259 const ParallelMove& pm = *printable.parallel_move_; | 309 const ParallelMove& pm = *printable.parallel_move_; |
260 bool first = true; | 310 bool first = true; |
261 for (auto move : pm) { | 311 for (auto move : pm) { |
262 if (move->IsEliminated()) continue; | 312 if (move->IsEliminated()) continue; |
263 if (!first) os << " "; | 313 if (!first) os << " "; |
264 first = false; | 314 first = false; |
265 PrintableMoveOperands pmo = {printable.register_configuration_, move}; | 315 PrintableMoveOperands pmo = {printable.register_configuration_, move}; |
266 os << pmo; | 316 os << pmo; |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 return true; | 787 return true; |
738 } | 788 } |
739 | 789 |
740 | 790 |
741 void InstructionSequence::SetSourcePosition(const Instruction* instr, | 791 void InstructionSequence::SetSourcePosition(const Instruction* instr, |
742 SourcePosition value) { | 792 SourcePosition value) { |
743 source_positions_.insert(std::make_pair(instr, value)); | 793 source_positions_.insert(std::make_pair(instr, value)); |
744 } | 794 } |
745 | 795 |
746 | 796 |
| 797 void InstructionSequence::Print(const RegisterConfiguration* config) const { |
| 798 OFStream os(stdout); |
| 799 PrintableInstructionSequence wrapper; |
| 800 wrapper.register_configuration_ = config; |
| 801 wrapper.sequence_ = this; |
| 802 os << wrapper << std::endl; |
| 803 } |
| 804 |
| 805 |
| 806 void InstructionSequence::Print() const { |
| 807 const RegisterConfiguration* config = |
| 808 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN); |
| 809 Print(config); |
| 810 } |
| 811 |
| 812 |
747 FrameStateDescriptor::FrameStateDescriptor( | 813 FrameStateDescriptor::FrameStateDescriptor( |
748 Zone* zone, FrameStateType type, BailoutId bailout_id, | 814 Zone* zone, FrameStateType type, BailoutId bailout_id, |
749 OutputFrameStateCombine state_combine, size_t parameters_count, | 815 OutputFrameStateCombine state_combine, size_t parameters_count, |
750 size_t locals_count, size_t stack_count, | 816 size_t locals_count, size_t stack_count, |
751 MaybeHandle<SharedFunctionInfo> shared_info, | 817 MaybeHandle<SharedFunctionInfo> shared_info, |
752 FrameStateDescriptor* outer_state) | 818 FrameStateDescriptor* outer_state) |
753 : type_(type), | 819 : type_(type), |
754 bailout_id_(bailout_id), | 820 bailout_id_(bailout_id), |
755 frame_state_combine_(state_combine), | 821 frame_state_combine_(state_combine), |
756 parameters_count_(parameters_count), | 822 parameters_count_(parameters_count), |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 os << " B" << succ.ToInt(); | 951 os << " B" << succ.ToInt(); |
886 } | 952 } |
887 os << "\n"; | 953 os << "\n"; |
888 } | 954 } |
889 return os; | 955 return os; |
890 } | 956 } |
891 | 957 |
892 } // namespace compiler | 958 } // namespace compiler |
893 } // namespace internal | 959 } // namespace internal |
894 } // namespace v8 | 960 } // namespace v8 |
OLD | NEW |