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/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 i < NodeProperties::PastControlIndex(node); ++i) { | 232 i < NodeProperties::PastControlIndex(node); ++i) { |
233 Enqueue(node->InputAt(i)); // Control inputs: just visit | 233 Enqueue(node->InputAt(i)); // Control inputs: just visit |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 // The default, most general visitation case. For {node}, process all value, | 237 // The default, most general visitation case. For {node}, process all value, |
238 // context, effect, and control inputs, assuming that value inputs should have | 238 // context, effect, and control inputs, assuming that value inputs should have |
239 // {kRepTagged} representation and can observe all output values {kTypeAny}. | 239 // {kRepTagged} representation and can observe all output values {kTypeAny}. |
240 void VisitInputs(Node* node) { | 240 void VisitInputs(Node* node) { |
241 InputIter i = node->inputs().begin(); | 241 InputIter i = node->inputs().begin(); |
242 for (int j = OperatorProperties::GetValueInputCount(node->op()); j > 0; | 242 for (int j = node->op()->ValueInputCount(); j > 0; ++i, j--) { |
243 ++i, j--) { | |
244 ProcessInput(node, i.index(), kMachAnyTagged); // Value inputs | 243 ProcessInput(node, i.index(), kMachAnyTagged); // Value inputs |
245 } | 244 } |
246 for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0; | 245 for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0; |
247 ++i, j--) { | 246 ++i, j--) { |
248 ProcessInput(node, i.index(), kMachAnyTagged); // Context inputs | 247 ProcessInput(node, i.index(), kMachAnyTagged); // Context inputs |
249 } | 248 } |
250 for (int j = OperatorProperties::GetEffectInputCount(node->op()); j > 0; | 249 for (int j = node->op()->EffectInputCount(); j > 0; ++i, j--) { |
251 ++i, j--) { | |
252 Enqueue(*i); // Effect inputs: just visit | 250 Enqueue(*i); // Effect inputs: just visit |
253 } | 251 } |
254 for (int j = OperatorProperties::GetControlInputCount(node->op()); j > 0; | 252 for (int j = node->op()->ControlInputCount(); j > 0; ++i, j--) { |
255 ++i, j--) { | |
256 Enqueue(*i); // Control inputs: just visit | 253 Enqueue(*i); // Control inputs: just visit |
257 } | 254 } |
258 SetOutput(node, kMachAnyTagged); | 255 SetOutput(node, kMachAnyTagged); |
259 } | 256 } |
260 | 257 |
261 // Helper for binops of the I x I -> O variety. | 258 // Helper for binops of the I x I -> O variety. |
262 void VisitBinop(Node* node, MachineTypeUnion input_use, | 259 void VisitBinop(Node* node, MachineTypeUnion input_use, |
263 MachineTypeUnion output) { | 260 MachineTypeUnion output) { |
264 DCHECK_EQ(2, node->InputCount()); | 261 DCHECK_EQ(2, node->InputCount()); |
265 ProcessInput(node, 0, input_use); | 262 ProcessInput(node, 0, input_use); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } else { | 424 } else { |
428 // legal = kRepTagged; | 425 // legal = kRepTagged; |
429 output = kRepTagged; | 426 output = kRepTagged; |
430 propagate = kRepTagged; | 427 propagate = kRepTagged; |
431 } | 428 } |
432 | 429 |
433 MachineType output_type = | 430 MachineType output_type = |
434 static_cast<MachineType>(changer_->TypeFromUpperBound(upper) | output); | 431 static_cast<MachineType>(changer_->TypeFromUpperBound(upper) | output); |
435 SetOutput(node, output_type); | 432 SetOutput(node, output_type); |
436 | 433 |
437 int values = OperatorProperties::GetValueInputCount(node->op()); | 434 int values = node->op()->ValueInputCount(); |
438 | 435 |
439 if (lower()) { | 436 if (lower()) { |
440 // Update the phi operator. | 437 // Update the phi operator. |
441 MachineType type = static_cast<MachineType>(output_type); | 438 MachineType type = static_cast<MachineType>(output_type); |
442 if (type != OpParameter<MachineType>(node)) { | 439 if (type != OpParameter<MachineType>(node)) { |
443 node->set_op(lowering->common()->Phi(type, values)); | 440 node->set_op(lowering->common()->Phi(type, values)); |
444 } | 441 } |
445 | 442 |
446 // Convert inputs to the output representation of this phi. | 443 // Convert inputs to the output representation of this phi. |
447 Node::Inputs inputs = node->inputs(); | 444 Node::Inputs inputs = node->inputs(); |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 | 1518 |
1522 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1519 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1523 node->set_op(machine()->IntLessThanOrEqual()); | 1520 node->set_op(machine()->IntLessThanOrEqual()); |
1524 node->ReplaceInput(0, StringComparison(node, true)); | 1521 node->ReplaceInput(0, StringComparison(node, true)); |
1525 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1522 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1526 } | 1523 } |
1527 | 1524 |
1528 } // namespace compiler | 1525 } // namespace compiler |
1529 } // namespace internal | 1526 } // namespace internal |
1530 } // namespace v8 | 1527 } // namespace v8 |
OLD | NEW |