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/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
| 6 | 6 |
| 7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/instruction-selector-impl.h" | 8 #include "src/compiler/instruction-selector-impl.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 instructions_.push_back(instr); | 147 instructions_.push_back(instr); |
| 148 return instr; | 148 return instr; |
| 149 } | 149 } |
| 150 | 150 |
| 151 | 151 |
| 152 bool InstructionSelector::IsNextInAssemblyOrder(const BasicBlock* block) const { | 152 bool InstructionSelector::IsNextInAssemblyOrder(const BasicBlock* block) const { |
| 153 return current_block_->GetAoNumber().IsNext(block->GetAoNumber()); | 153 return current_block_->GetAoNumber().IsNext(block->GetAoNumber()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 | 156 |
| 157 bool InstructionSelector::ValueOwnedBy(Node* owner, Node* value) const { | |
|
titzer
2014/11/20 12:39:24
Maybe we can move this to a more generic location
danno
2014/11/20 13:43:07
As discussed, the new patch set uses IsLive rather
| |
| 158 Node::Uses uses = value->uses(); | |
| 159 bool found_use = false; | |
| 160 for (Node::Uses::iterator current = uses.begin(); current != uses.end(); | |
|
titzer
2014/11/20 12:39:24
You can use a C++ foreach here now!
| |
| 161 ++current) { | |
| 162 Node* use = *current; | |
| 163 if (use == owner) { | |
| 164 found_use = true; | |
| 165 } else if (!NodeProperties::IsEffectEdge(current.edge())) { | |
| 166 return false; | |
| 167 } | |
| 168 } | |
| 169 return found_use; | |
| 170 } | |
| 171 | |
| 172 | |
| 157 bool InstructionSelector::CanCover(Node* user, Node* node) const { | 173 bool InstructionSelector::CanCover(Node* user, Node* node) const { |
| 158 return node->OwnedBy(user) && | 174 return node->OwnedBy(user) && |
| 159 schedule()->block(node) == schedule()->block(user); | 175 schedule()->block(node) == schedule()->block(user); |
| 160 } | 176 } |
| 161 | 177 |
| 162 | 178 |
| 163 int InstructionSelector::GetVirtualRegister(const Node* node) { | 179 int InstructionSelector::GetVirtualRegister(const Node* node) { |
| 164 if (node_map_[node->id()] == kNodeUnmapped) { | 180 if (node_map_[node->id()] == kNodeUnmapped) { |
| 165 node_map_[node->id()] = sequence()->NextVirtualRegister(); | 181 node_map_[node->id()] = sequence()->NextVirtualRegister(); |
| 166 } | 182 } |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1114 MachineOperatorBuilder::Flags | 1130 MachineOperatorBuilder::Flags |
| 1115 InstructionSelector::SupportedMachineOperatorFlags() { | 1131 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1116 return MachineOperatorBuilder::Flag::kNoFlags; | 1132 return MachineOperatorBuilder::Flag::kNoFlags; |
| 1117 } | 1133 } |
| 1118 | 1134 |
| 1119 #endif // !V8_TURBOFAN_BACKEND | 1135 #endif // !V8_TURBOFAN_BACKEND |
| 1120 | 1136 |
| 1121 } // namespace compiler | 1137 } // namespace compiler |
| 1122 } // namespace internal | 1138 } // namespace internal |
| 1123 } // namespace v8 | 1139 } // namespace v8 |
| OLD | NEW |