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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 // 4. Only {node} must have value edges pointing to {user}. | 235 // 4. Only {node} must have value edges pointing to {user}. |
236 for (Edge const edge : node->use_edges()) { | 236 for (Edge const edge : node->use_edges()) { |
237 if (edge.from() != user && NodeProperties::IsValueEdge(edge)) { | 237 if (edge.from() != user && NodeProperties::IsValueEdge(edge)) { |
238 return false; | 238 return false; |
239 } | 239 } |
240 } | 240 } |
241 return true; | 241 return true; |
242 } | 242 } |
243 | 243 |
| 244 bool InstructionSelector::IsOnlyUserOfNodeInSameBlock(Node* user, |
| 245 Node* node) const { |
| 246 BasicBlock* bb_user = schedule()->block(user); |
| 247 BasicBlock* bb_node = schedule()->block(node); |
| 248 if (bb_user != bb_node) return false; |
| 249 for (Edge const edge : node->use_edges()) { |
| 250 Node* from = edge.from(); |
| 251 if ((from != user) && (schedule()->block(from) == bb_user)) { |
| 252 return false; |
| 253 } |
| 254 } |
| 255 return true; |
| 256 } |
| 257 |
244 int InstructionSelector::GetVirtualRegister(const Node* node) { | 258 int InstructionSelector::GetVirtualRegister(const Node* node) { |
245 DCHECK_NOT_NULL(node); | 259 DCHECK_NOT_NULL(node); |
246 size_t const id = node->id(); | 260 size_t const id = node->id(); |
247 DCHECK_LT(id, virtual_registers_.size()); | 261 DCHECK_LT(id, virtual_registers_.size()); |
248 int virtual_register = virtual_registers_[id]; | 262 int virtual_register = virtual_registers_[id]; |
249 if (virtual_register == InstructionOperand::kInvalidVirtualRegister) { | 263 if (virtual_register == InstructionOperand::kInvalidVirtualRegister) { |
250 virtual_register = sequence()->NextVirtualRegister(); | 264 virtual_register = sequence()->NextVirtualRegister(); |
251 virtual_registers_[id] = virtual_register; | 265 virtual_registers_[id] = virtual_register; |
252 } | 266 } |
253 return virtual_register; | 267 return virtual_register; |
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1937 return new (instruction_zone()) FrameStateDescriptor( | 1951 return new (instruction_zone()) FrameStateDescriptor( |
1938 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1952 instruction_zone(), state_info.type(), state_info.bailout_id(), |
1939 state_info.state_combine(), parameters, locals, stack, | 1953 state_info.state_combine(), parameters, locals, stack, |
1940 state_info.shared_info(), outer_state); | 1954 state_info.shared_info(), outer_state); |
1941 } | 1955 } |
1942 | 1956 |
1943 | 1957 |
1944 } // namespace compiler | 1958 } // namespace compiler |
1945 } // namespace internal | 1959 } // namespace internal |
1946 } // namespace v8 | 1960 } // namespace v8 |
OLD | NEW |