OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/graph-builder.h" | 5 #include "src/compiler/graph-builder.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/generic-graph.h" | 8 #include "src/compiler/generic-graph.h" |
9 #include "src/compiler/generic-node.h" | 9 #include "src/compiler/generic-node.h" |
10 #include "src/compiler/generic-node-inl.h" | 10 #include "src/compiler/generic-node-inl.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 for (int i = 0; i < static_cast<int>(values()->size()); ++i) { | 154 for (int i = 0; i < static_cast<int>(values()->size()); ++i) { |
155 Node* phi = builder_->NewPhi(1, values()->at(i), control); | 155 Node* phi = builder_->NewPhi(1, values()->at(i), control); |
156 values()->at(i) = phi; | 156 values()->at(i) = phi; |
157 } | 157 } |
158 Node* effect = builder_->NewEffectPhi(1, GetEffectDependency(), control); | 158 Node* effect = builder_->NewEffectPhi(1, GetEffectDependency(), control); |
159 UpdateEffectDependency(effect); | 159 UpdateEffectDependency(effect); |
160 } | 160 } |
161 | 161 |
162 | 162 |
163 Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) { | 163 Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) { |
164 Operator* phi_op = common()->Phi(count); | 164 Operator* phi_op = common()->Phi(kMachAnyTagged, count); |
165 Node** buffer = zone()->NewArray<Node*>(count + 1); | 165 Node** buffer = zone()->NewArray<Node*>(count + 1); |
166 MemsetPointer(buffer, input, count); | 166 MemsetPointer(buffer, input, count); |
167 buffer[count] = control; | 167 buffer[count] = control; |
168 return graph()->NewNode(phi_op, count + 1, buffer); | 168 return graph()->NewNode(phi_op, count + 1, buffer); |
169 } | 169 } |
170 | 170 |
171 | 171 |
172 // TODO(mstarzinger): Revisit this once we have proper effect states. | 172 // TODO(mstarzinger): Revisit this once we have proper effect states. |
173 Node* StructuredGraphBuilder::NewEffectPhi(int count, Node* input, | 173 Node* StructuredGraphBuilder::NewEffectPhi(int count, Node* input, |
174 Node* control) { | 174 Node* control) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return value; | 217 return value; |
218 } | 218 } |
219 | 219 |
220 | 220 |
221 Node* StructuredGraphBuilder::MergeValue(Node* value, Node* other, | 221 Node* StructuredGraphBuilder::MergeValue(Node* value, Node* other, |
222 Node* control) { | 222 Node* control) { |
223 int inputs = OperatorProperties::GetControlInputCount(control->op()); | 223 int inputs = OperatorProperties::GetControlInputCount(control->op()); |
224 if (value->opcode() == IrOpcode::kPhi && | 224 if (value->opcode() == IrOpcode::kPhi && |
225 NodeProperties::GetControlInput(value) == control) { | 225 NodeProperties::GetControlInput(value) == control) { |
226 // Phi already exists, add input. | 226 // Phi already exists, add input. |
227 value->set_op(common()->Phi(inputs)); | 227 value->set_op(common()->Phi(kMachAnyTagged, inputs)); |
228 value->InsertInput(zone(), inputs - 1, other); | 228 value->InsertInput(zone(), inputs - 1, other); |
229 } else if (value != other) { | 229 } else if (value != other) { |
230 // Phi does not exist yet, introduce one. | 230 // Phi does not exist yet, introduce one. |
231 value = NewPhi(inputs, value, control); | 231 value = NewPhi(inputs, value, control); |
232 value->ReplaceInput(inputs - 1, other); | 232 value->ReplaceInput(inputs - 1, other); |
233 } | 233 } |
234 return value; | 234 return value; |
235 } | 235 } |
236 | 236 |
237 | 237 |
238 Node* StructuredGraphBuilder::dead_control() { | 238 Node* StructuredGraphBuilder::dead_control() { |
239 if (!dead_control_.is_set()) { | 239 if (!dead_control_.is_set()) { |
240 Node* dead_node = graph()->NewNode(common_->Dead()); | 240 Node* dead_node = graph()->NewNode(common_->Dead()); |
241 dead_control_.set(dead_node); | 241 dead_control_.set(dead_node); |
242 return dead_node; | 242 return dead_node; |
243 } | 243 } |
244 return dead_control_.get(); | 244 return dead_control_.get(); |
245 } | 245 } |
246 } | 246 } |
247 } | 247 } |
248 } // namespace v8::internal::compiler | 248 } // namespace v8::internal::compiler |
OLD | NEW |