Chromium Code Reviews| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 << "]"; | 98 << "]"; |
| 99 case InstructionOperand::IMMEDIATE: { | 99 case InstructionOperand::IMMEDIATE: { |
| 100 auto imm = ImmediateOperand::cast(op); | 100 auto imm = ImmediateOperand::cast(op); |
| 101 switch (imm.type()) { | 101 switch (imm.type()) { |
| 102 case ImmediateOperand::INLINE: | 102 case ImmediateOperand::INLINE: |
| 103 return os << "#" << imm.inline_value(); | 103 return os << "#" << imm.inline_value(); |
| 104 case ImmediateOperand::INDEXED: | 104 case ImmediateOperand::INDEXED: |
| 105 return os << "[immediate:" << imm.indexed_value() << "]"; | 105 return os << "[immediate:" << imm.indexed_value() << "]"; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 case InstructionOperand::EXPLICIT: | |
|
Mircea Trofin
2015/10/15 15:05:38
Would it help debugging if Explicit had some extra
danno
2015/10/23 08:07:49
Done
| |
| 108 case InstructionOperand::ALLOCATED: { | 109 case InstructionOperand::ALLOCATED: { |
| 109 auto allocated = AllocatedOperand::cast(op); | 110 auto allocated = LocationOperand::cast(op); |
| 110 switch (allocated.allocated_kind()) { | 111 if (op.IsStackSlot()) { |
| 111 case AllocatedOperand::STACK_SLOT: | 112 os << "[stack:" << LocationOperand::cast(op).index(); |
| 112 os << "[stack:" << StackSlotOperand::cast(op).index(); | 113 } else if (op.IsDoubleStackSlot()) { |
| 113 break; | 114 os << "[double_stack:" << LocationOperand::cast(op).index(); |
| 114 case AllocatedOperand::DOUBLE_STACK_SLOT: | 115 } else if (op.IsRegister()) { |
| 115 os << "[double_stack:" << DoubleStackSlotOperand::cast(op).index(); | 116 os << "[" << LocationOperand::cast(op).GetRegister().ToString() << "|R"; |
| 116 break; | 117 } else { |
| 117 case AllocatedOperand::REGISTER: | 118 DCHECK(op.IsDoubleRegister()); |
| 118 os << "[" << RegisterOperand::cast(op).GetRegister().ToString() | 119 os << "[" << LocationOperand::cast(op).GetDoubleRegister().ToString() |
| 119 << "|R"; | 120 << "|R"; |
| 120 break; | |
| 121 case AllocatedOperand::DOUBLE_REGISTER: | |
| 122 os << "[" << DoubleRegisterOperand::cast(op).GetRegister().ToString() | |
| 123 << "|R"; | |
| 124 break; | |
| 125 } | 121 } |
| 126 switch (allocated.machine_type()) { | 122 switch (allocated.machine_type()) { |
| 127 case kRepWord32: | 123 case kRepWord32: |
| 128 os << "|w32"; | 124 os << "|w32"; |
| 129 break; | 125 break; |
| 130 case kRepWord64: | 126 case kRepWord64: |
| 131 os << "|w64"; | 127 os << "|w64"; |
| 132 break; | 128 break; |
| 133 case kRepFloat32: | 129 case kRepFloat32: |
| 134 os << "|f32"; | 130 os << "|f32"; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 } | 169 } |
| 174 return true; | 170 return true; |
| 175 } | 171 } |
| 176 | 172 |
| 177 | 173 |
| 178 MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const { | 174 MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const { |
| 179 MoveOperands* replacement = nullptr; | 175 MoveOperands* replacement = nullptr; |
| 180 MoveOperands* to_eliminate = nullptr; | 176 MoveOperands* to_eliminate = nullptr; |
| 181 for (auto curr : *this) { | 177 for (auto curr : *this) { |
| 182 if (curr->IsEliminated()) continue; | 178 if (curr->IsEliminated()) continue; |
| 183 if (curr->destination().EqualsModuloType(move->source())) { | 179 if (curr->destination().EqualsCanonicalizeType(move->source())) { |
| 184 DCHECK(!replacement); | 180 DCHECK(!replacement); |
| 185 replacement = curr; | 181 replacement = curr; |
| 186 if (to_eliminate != nullptr) break; | 182 if (to_eliminate != nullptr) break; |
| 187 } else if (curr->destination().EqualsModuloType(move->destination())) { | 183 } else if (curr->destination().EqualsCanonicalizeType( |
| 184 move->destination())) { | |
| 188 DCHECK(!to_eliminate); | 185 DCHECK(!to_eliminate); |
| 189 to_eliminate = curr; | 186 to_eliminate = curr; |
| 190 if (replacement != nullptr) break; | 187 if (replacement != nullptr) break; |
| 191 } | 188 } |
| 192 } | 189 } |
| 193 DCHECK_IMPLIES(replacement == to_eliminate, replacement == nullptr); | 190 DCHECK_IMPLIES(replacement == to_eliminate, replacement == nullptr); |
| 194 if (replacement != nullptr) move->set_source(replacement->source()); | 191 if (replacement != nullptr) move->set_source(replacement->source()); |
| 195 return to_eliminate; | 192 return to_eliminate; |
| 196 } | 193 } |
| 197 | 194 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 first = false; | 252 first = false; |
| 256 PrintableMoveOperands pmo = {printable.register_configuration_, move}; | 253 PrintableMoveOperands pmo = {printable.register_configuration_, move}; |
| 257 os << pmo; | 254 os << pmo; |
| 258 } | 255 } |
| 259 return os; | 256 return os; |
| 260 } | 257 } |
| 261 | 258 |
| 262 | 259 |
| 263 void ReferenceMap::RecordReference(const AllocatedOperand& op) { | 260 void ReferenceMap::RecordReference(const AllocatedOperand& op) { |
| 264 // Do not record arguments as pointers. | 261 // Do not record arguments as pointers. |
| 265 if (op.IsStackSlot() && StackSlotOperand::cast(op).index() < 0) return; | 262 if (op.IsStackSlot() && LocationOperand::cast(op).index() < 0) return; |
| 266 DCHECK(!op.IsDoubleRegister() && !op.IsDoubleStackSlot()); | 263 DCHECK(!op.IsDoubleRegister() && !op.IsDoubleStackSlot()); |
| 267 reference_operands_.push_back(op); | 264 reference_operands_.push_back(op); |
| 268 } | 265 } |
| 269 | 266 |
| 270 | 267 |
| 271 std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm) { | 268 std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm) { |
| 272 os << "{"; | 269 os << "{"; |
| 273 bool first = true; | 270 bool first = true; |
| 274 PrintableInstructionOperand poi = {RegisterConfiguration::ArchDefault(), | 271 PrintableInstructionOperand poi = {RegisterConfiguration::ArchDefault(), |
| 275 InstructionOperand()}; | 272 InstructionOperand()}; |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 os << " B" << succ.ToInt(); | 872 os << " B" << succ.ToInt(); |
| 876 } | 873 } |
| 877 os << "\n"; | 874 os << "\n"; |
| 878 } | 875 } |
| 879 return os; | 876 return os; |
| 880 } | 877 } |
| 881 | 878 |
| 882 } // namespace compiler | 879 } // namespace compiler |
| 883 } // namespace internal | 880 } // namespace internal |
| 884 } // namespace v8 | 881 } // namespace v8 |
| OLD | NEW |