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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } else { | 407 } else { |
408 // Propagate {use} of the phi to value inputs, and 0 to control. | 408 // Propagate {use} of the phi to value inputs, and 0 to control. |
409 MachineType use_type = | 409 MachineType use_type = |
410 static_cast<MachineType>((use & kTypeMask) | output); | 410 static_cast<MachineType>((use & kTypeMask) | output); |
411 for (int i = 0; i < node->InputCount(); i++) { | 411 for (int i = 0; i < node->InputCount(); i++) { |
412 ProcessInput(node, i, i < values ? use_type : 0); | 412 ProcessInput(node, i, i < values ? use_type : 0); |
413 } | 413 } |
414 } | 414 } |
415 } | 415 } |
416 | 416 |
| 417 void VisitCall(Node* node, SimplifiedLowering* lowering) { |
| 418 const CallDescriptor* desc = OpParameter<const CallDescriptor*>(node->op()); |
| 419 const MachineSignature* sig = desc->GetMachineSignature(); |
| 420 int params = static_cast<int>(sig->parameter_count()); |
| 421 // Propagate representation information from call descriptor. |
| 422 for (int i = 0; i < node->InputCount(); i++) { |
| 423 if (i == 0) { |
| 424 // The target of the call. |
| 425 ProcessInput(node, i, 0); |
| 426 } else if ((i - 1) < params) { |
| 427 ProcessInput(node, i, sig->GetParam(i - 1)); |
| 428 } else { |
| 429 ProcessInput(node, i, 0); |
| 430 } |
| 431 } |
| 432 |
| 433 SetOutput(node, desc->GetMachineSignature()->GetReturn()); |
| 434 } |
| 435 |
417 void VisitStateValues(Node* node) { | 436 void VisitStateValues(Node* node) { |
418 if (phase_ == PROPAGATE) { | 437 if (phase_ == PROPAGATE) { |
419 for (int i = 0; i < node->InputCount(); i++) { | 438 for (int i = 0; i < node->InputCount(); i++) { |
420 Enqueue(node->InputAt(i), kTypeAny); | 439 Enqueue(node->InputAt(i), kTypeAny); |
421 } | 440 } |
422 } else { | 441 } else { |
423 Zone* zone = jsgraph_->zone(); | 442 Zone* zone = jsgraph_->zone(); |
424 ZoneVector<MachineType>* types = | 443 ZoneVector<MachineType>* types = |
425 new (zone->New(sizeof(ZoneVector<MachineType>))) | 444 new (zone->New(sizeof(ZoneVector<MachineType>))) |
426 ZoneVector<MachineType>(node->InputCount(), zone); | 445 ZoneVector<MachineType>(node->InputCount(), zone); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 Enqueue(NodeProperties::GetControlInput(node, 0)); | 545 Enqueue(NodeProperties::GetControlInput(node, 0)); |
527 break; | 546 break; |
528 case IrOpcode::kSwitch: | 547 case IrOpcode::kSwitch: |
529 ProcessInput(node, 0, kRepWord32); | 548 ProcessInput(node, 0, kRepWord32); |
530 Enqueue(NodeProperties::GetControlInput(node, 0)); | 549 Enqueue(NodeProperties::GetControlInput(node, 0)); |
531 break; | 550 break; |
532 case IrOpcode::kSelect: | 551 case IrOpcode::kSelect: |
533 return VisitSelect(node, use, lowering); | 552 return VisitSelect(node, use, lowering); |
534 case IrOpcode::kPhi: | 553 case IrOpcode::kPhi: |
535 return VisitPhi(node, use, lowering); | 554 return VisitPhi(node, use, lowering); |
| 555 case IrOpcode::kCall: |
| 556 return VisitCall(node, lowering); |
536 | 557 |
537 //------------------------------------------------------------------ | 558 //------------------------------------------------------------------ |
538 // JavaScript operators. | 559 // JavaScript operators. |
539 //------------------------------------------------------------------ | 560 //------------------------------------------------------------------ |
540 // For now, we assume that all JS operators were too complex to lower | 561 // For now, we assume that all JS operators were too complex to lower |
541 // to Simplified and that they will always require tagged value inputs | 562 // to Simplified and that they will always require tagged value inputs |
542 // and produce tagged value outputs. | 563 // and produce tagged value outputs. |
543 // TODO(turbofan): it might be possible to lower some JSOperators here, | 564 // TODO(turbofan): it might be possible to lower some JSOperators here, |
544 // but that responsibility really lies in the typed lowering phase. | 565 // but that responsibility really lies in the typed lowering phase. |
545 #define DEFINE_JS_CASE(x) case IrOpcode::k##x: | 566 #define DEFINE_JS_CASE(x) case IrOpcode::k##x: |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 | 1654 |
1634 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1655 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1635 node->set_op(machine()->IntLessThanOrEqual()); | 1656 node->set_op(machine()->IntLessThanOrEqual()); |
1636 node->ReplaceInput(0, StringComparison(node, true)); | 1657 node->ReplaceInput(0, StringComparison(node, true)); |
1637 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1658 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1638 } | 1659 } |
1639 | 1660 |
1640 } // namespace compiler | 1661 } // namespace compiler |
1641 } // namespace internal | 1662 } // namespace internal |
1642 } // namespace v8 | 1663 } // namespace v8 |
OLD | NEW |