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

Side by Side Diff: src/compiler/instruction.cc

Issue 2293413004: trace-turbo should respect --redirect-code-traces (Closed)
Patch Set: Created 4 years, 3 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/instruction.h ('k') | src/compiler/pipeline.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 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 return condition; 61 return condition;
62 } 62 }
63 UNREACHABLE(); 63 UNREACHABLE();
64 return condition; 64 return condition;
65 } 65 }
66 66
67 bool InstructionOperand::InterferesWith(const InstructionOperand& that) const { 67 bool InstructionOperand::InterferesWith(const InstructionOperand& that) const {
68 return EqualsCanonicalized(that); 68 return EqualsCanonicalized(that);
69 } 69 }
70 70
71 void InstructionOperand::Print(const RegisterConfiguration* config) const { 71 void InstructionOperand::Print(std::ostream& os,
72 OFStream os(stdout); 72 const RegisterConfiguration* config) const {
73 PrintableInstructionOperand wrapper; 73 PrintableInstructionOperand wrapper;
74 wrapper.register_configuration_ = config; 74 wrapper.register_configuration_ = config;
75 wrapper.op_ = *this; 75 wrapper.op_ = *this;
76 os << wrapper << std::endl; 76 os << wrapper << std::endl;
77 } 77 }
78 78
79 void InstructionOperand::Print() const { Print(GetRegConfig()); } 79 void InstructionOperand::Print(std::ostream& os) const {
80 Print(os, GetRegConfig());
81 }
80 82
81 std::ostream& operator<<(std::ostream& os, 83 std::ostream& operator<<(std::ostream& os,
82 const PrintableInstructionOperand& printable) { 84 const PrintableInstructionOperand& printable) {
83 const InstructionOperand& op = printable.op_; 85 const InstructionOperand& op = printable.op_;
84 const RegisterConfiguration* conf = printable.register_configuration_; 86 const RegisterConfiguration* conf = printable.register_configuration_;
85 switch (op.kind()) { 87 switch (op.kind()) {
86 case InstructionOperand::UNALLOCATED: { 88 case InstructionOperand::UNALLOCATED: {
87 const UnallocatedOperand* unalloc = UnallocatedOperand::cast(&op); 89 const UnallocatedOperand* unalloc = UnallocatedOperand::cast(&op);
88 os << "v" << unalloc->virtual_register(); 90 os << "v" << unalloc->virtual_register();
89 if (unalloc->basic_policy() == UnallocatedOperand::FIXED_SLOT) { 91 if (unalloc->basic_policy() == UnallocatedOperand::FIXED_SLOT) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 194 }
193 return os << "]"; 195 return os << "]";
194 } 196 }
195 case InstructionOperand::INVALID: 197 case InstructionOperand::INVALID:
196 return os << "(x)"; 198 return os << "(x)";
197 } 199 }
198 UNREACHABLE(); 200 UNREACHABLE();
199 return os; 201 return os;
200 } 202 }
201 203
202 void MoveOperands::Print(const RegisterConfiguration* config) const { 204 void MoveOperands::Print(std::ostream& os,
203 OFStream os(stdout); 205 const RegisterConfiguration* config) const {
204 PrintableInstructionOperand wrapper; 206 PrintableInstructionOperand wrapper;
205 wrapper.register_configuration_ = config; 207 wrapper.register_configuration_ = config;
206 wrapper.op_ = destination(); 208 wrapper.op_ = destination();
207 os << wrapper << " = "; 209 os << wrapper << " = ";
208 wrapper.op_ = source(); 210 wrapper.op_ = source();
209 os << wrapper << std::endl; 211 os << wrapper << std::endl;
210 } 212 }
211 213
212 void MoveOperands::Print() const { Print(GetRegConfig()); } 214 void MoveOperands::Print(std::ostream& os) const { Print(os, GetRegConfig()); }
213 215
214 std::ostream& operator<<(std::ostream& os, 216 std::ostream& operator<<(std::ostream& os,
215 const PrintableMoveOperands& printable) { 217 const PrintableMoveOperands& printable) {
216 const MoveOperands& mo = *printable.move_operands_; 218 const MoveOperands& mo = *printable.move_operands_;
217 PrintableInstructionOperand printable_op = {printable.register_configuration_, 219 PrintableInstructionOperand printable_op = {printable.register_configuration_,
218 mo.destination()}; 220 mo.destination()};
219 os << printable_op; 221 os << printable_op;
220 if (!mo.source().Equals(mo.destination())) { 222 if (!mo.source().Equals(mo.destination())) {
221 printable_op.op_ = mo.source(); 223 printable_op.op_ = mo.source();
222 os << " = " << printable_op; 224 os << " = " << printable_op;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 bool Instruction::AreMovesRedundant() const { 309 bool Instruction::AreMovesRedundant() const {
308 for (int i = Instruction::FIRST_GAP_POSITION; 310 for (int i = Instruction::FIRST_GAP_POSITION;
309 i <= Instruction::LAST_GAP_POSITION; i++) { 311 i <= Instruction::LAST_GAP_POSITION; i++) {
310 if (parallel_moves_[i] != nullptr && !parallel_moves_[i]->IsRedundant()) { 312 if (parallel_moves_[i] != nullptr && !parallel_moves_[i]->IsRedundant()) {
311 return false; 313 return false;
312 } 314 }
313 } 315 }
314 return true; 316 return true;
315 } 317 }
316 318
317 319 void Instruction::Print(std::ostream& os,
318 void Instruction::Print(const RegisterConfiguration* config) const { 320 const RegisterConfiguration* config) const {
319 OFStream os(stdout);
320 PrintableInstruction wrapper; 321 PrintableInstruction wrapper;
321 wrapper.instr_ = this; 322 wrapper.instr_ = this;
322 wrapper.register_configuration_ = config; 323 wrapper.register_configuration_ = config;
323 os << wrapper << std::endl; 324 os << wrapper << std::endl;
324 } 325 }
325 326
326 void Instruction::Print() const { Print(GetRegConfig()); } 327 void Instruction::Print(std::ostream& os) const { Print(os, GetRegConfig()); }
327 328
328 std::ostream& operator<<(std::ostream& os, 329 std::ostream& operator<<(std::ostream& os,
329 const PrintableParallelMove& printable) { 330 const PrintableParallelMove& printable) {
330 const ParallelMove& pm = *printable.parallel_move_; 331 const ParallelMove& pm = *printable.parallel_move_;
331 bool first = true; 332 bool first = true;
332 for (MoveOperands* move : pm) { 333 for (MoveOperands* move : pm) {
333 if (move->IsEliminated()) continue; 334 if (move->IsEliminated()) continue;
334 if (!first) os << " "; 335 if (!first) os << " ";
335 first = false; 336 first = false;
336 PrintableMoveOperands pmo = {printable.register_configuration_, move}; 337 PrintableMoveOperands pmo = {printable.register_configuration_, move};
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 *result = it->second; 868 *result = it->second;
868 return true; 869 return true;
869 } 870 }
870 871
871 872
872 void InstructionSequence::SetSourcePosition(const Instruction* instr, 873 void InstructionSequence::SetSourcePosition(const Instruction* instr,
873 SourcePosition value) { 874 SourcePosition value) {
874 source_positions_.insert(std::make_pair(instr, value)); 875 source_positions_.insert(std::make_pair(instr, value));
875 } 876 }
876 877
877 878 void InstructionSequence::Print(std::ostream& os,
878 void InstructionSequence::Print(const RegisterConfiguration* config) const { 879 const RegisterConfiguration* config) const {
879 OFStream os(stdout);
880 PrintableInstructionSequence wrapper; 880 PrintableInstructionSequence wrapper;
881 wrapper.register_configuration_ = config; 881 wrapper.register_configuration_ = config;
882 wrapper.sequence_ = this; 882 wrapper.sequence_ = this;
883 os << wrapper << std::endl; 883 os << wrapper << std::endl;
884 } 884 }
885 885
886 void InstructionSequence::Print() const { Print(GetRegConfig()); } 886 void InstructionSequence::Print(std::ostream& os) const {
887 Print(os, GetRegConfig());
888 }
887 889
888 void InstructionSequence::PrintBlock(const RegisterConfiguration* config, 890 void InstructionSequence::PrintBlock(std::ostream& os,
891 const RegisterConfiguration* config,
889 int block_id) const { 892 int block_id) const {
890 OFStream os(stdout);
891 RpoNumber rpo = RpoNumber::FromInt(block_id); 893 RpoNumber rpo = RpoNumber::FromInt(block_id);
892 const InstructionBlock* block = InstructionBlockAt(rpo); 894 const InstructionBlock* block = InstructionBlockAt(rpo);
893 CHECK(block->rpo_number() == rpo); 895 CHECK(block->rpo_number() == rpo);
894 896
895 os << "B" << block->rpo_number(); 897 os << "B" << block->rpo_number();
896 os << ": AO#" << block->ao_number(); 898 os << ": AO#" << block->ao_number();
897 if (block->IsDeferred()) os << " (deferred)"; 899 if (block->IsDeferred()) os << " (deferred)";
898 if (!block->needs_frame()) os << " (no frame)"; 900 if (!block->needs_frame()) os << " (no frame)";
899 if (block->must_construct_frame()) os << " (construct frame)"; 901 if (block->must_construct_frame()) os << " (construct frame)";
900 if (block->must_deconstruct_frame()) os << " (deconstruct frame)"; 902 if (block->must_deconstruct_frame()) os << " (deconstruct frame)";
(...skipping 28 matching lines...) Expand all
929 printable_instr.instr_ = InstructionAt(j); 931 printable_instr.instr_ = InstructionAt(j);
930 os << " " << buf.start() << ": " << printable_instr << "\n"; 932 os << " " << buf.start() << ": " << printable_instr << "\n";
931 } 933 }
932 934
933 for (RpoNumber succ : block->successors()) { 935 for (RpoNumber succ : block->successors()) {
934 os << " B" << succ.ToInt(); 936 os << " B" << succ.ToInt();
935 } 937 }
936 os << "\n"; 938 os << "\n";
937 } 939 }
938 940
939 void InstructionSequence::PrintBlock(int block_id) const { 941 void InstructionSequence::PrintBlock(std::ostream& os, int block_id) const {
940 PrintBlock(GetRegConfig(), block_id); 942 PrintBlock(os, GetRegConfig(), block_id);
941 } 943 }
942 944
943 FrameStateDescriptor::FrameStateDescriptor( 945 FrameStateDescriptor::FrameStateDescriptor(
944 Zone* zone, FrameStateType type, BailoutId bailout_id, 946 Zone* zone, FrameStateType type, BailoutId bailout_id,
945 OutputFrameStateCombine state_combine, size_t parameters_count, 947 OutputFrameStateCombine state_combine, size_t parameters_count,
946 size_t locals_count, size_t stack_count, 948 size_t locals_count, size_t stack_count,
947 MaybeHandle<SharedFunctionInfo> shared_info, 949 MaybeHandle<SharedFunctionInfo> shared_info,
948 FrameStateDescriptor* outer_state) 950 FrameStateDescriptor* outer_state)
949 : type_(type), 951 : type_(type),
950 bailout_id_(bailout_id), 952 bailout_id_(bailout_id),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 for (size_t i = 0; i < code.immediates_.size(); ++i) { 1016 for (size_t i = 0; i < code.immediates_.size(); ++i) {
1015 Constant constant = code.immediates_[i]; 1017 Constant constant = code.immediates_[i];
1016 os << "IMM#" << i << ": " << constant << "\n"; 1018 os << "IMM#" << i << ": " << constant << "\n";
1017 } 1019 }
1018 int i = 0; 1020 int i = 0;
1019 for (ConstantMap::const_iterator it = code.constants_.begin(); 1021 for (ConstantMap::const_iterator it = code.constants_.begin();
1020 it != code.constants_.end(); ++i, ++it) { 1022 it != code.constants_.end(); ++i, ++it) {
1021 os << "CST#" << i << ": v" << it->first << " = " << it->second << "\n"; 1023 os << "CST#" << i << ": v" << it->first << " = " << it->second << "\n";
1022 } 1024 }
1023 for (int i = 0; i < code.InstructionBlockCount(); i++) { 1025 for (int i = 0; i < code.InstructionBlockCount(); i++) {
1024 printable.sequence_->PrintBlock(printable.register_configuration_, i); 1026 printable.sequence_->PrintBlock(os, printable.register_configuration_, i);
1025 } 1027 }
1026 return os; 1028 return os;
1027 } 1029 }
1028 1030
1029 } // namespace compiler 1031 } // namespace compiler
1030 } // namespace internal 1032 } // namespace internal
1031 } // namespace v8 1033 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698