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/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
| 10 #include "src/compiler/pipeline.h" |
10 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 namespace compiler { | 14 namespace compiler { |
14 | 15 |
15 InstructionSelector::InstructionSelector(InstructionSequence* sequence, | 16 InstructionSelector::InstructionSelector(InstructionSequence* sequence, |
16 SourcePositionTable* source_positions) | 17 SourcePositionTable* source_positions) |
17 : zone_(sequence->isolate()), | 18 : zone_(sequence->isolate()), |
18 sequence_(sequence), | 19 sequence_(sequence), |
19 source_positions_(source_positions), | 20 source_positions_(source_positions), |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 return VisitFloat64LessThan(node); | 577 return VisitFloat64LessThan(node); |
577 case IrOpcode::kFloat64LessThanOrEqual: | 578 case IrOpcode::kFloat64LessThanOrEqual: |
578 return VisitFloat64LessThanOrEqual(node); | 579 return VisitFloat64LessThanOrEqual(node); |
579 default: | 580 default: |
580 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d", | 581 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d", |
581 node->opcode(), node->op()->mnemonic(), node->id()); | 582 node->opcode(), node->op()->mnemonic(), node->id()); |
582 } | 583 } |
583 } | 584 } |
584 | 585 |
585 | 586 |
| 587 #if V8_TURBOFAN_TARGET |
| 588 |
586 void InstructionSelector::VisitWord32Equal(Node* node) { | 589 void InstructionSelector::VisitWord32Equal(Node* node) { |
587 FlagsContinuation cont(kEqual, node); | 590 FlagsContinuation cont(kEqual, node); |
588 Int32BinopMatcher m(node); | 591 Int32BinopMatcher m(node); |
589 if (m.right().Is(0)) { | 592 if (m.right().Is(0)) { |
590 return VisitWord32Test(m.left().node(), &cont); | 593 return VisitWord32Test(m.left().node(), &cont); |
591 } | 594 } |
592 VisitWord32Compare(node, &cont); | 595 VisitWord32Compare(node, &cont); |
593 } | 596 } |
594 | 597 |
595 | 598 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 FlagsContinuation cont(kUnorderedLessThan, node); | 652 FlagsContinuation cont(kUnorderedLessThan, node); |
650 VisitFloat64Compare(node, &cont); | 653 VisitFloat64Compare(node, &cont); |
651 } | 654 } |
652 | 655 |
653 | 656 |
654 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { | 657 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { |
655 FlagsContinuation cont(kUnorderedLessThanOrEqual, node); | 658 FlagsContinuation cont(kUnorderedLessThanOrEqual, node); |
656 VisitFloat64Compare(node, &cont); | 659 VisitFloat64Compare(node, &cont); |
657 } | 660 } |
658 | 661 |
| 662 #endif // V8_TURBOFAN_TARGET |
659 | 663 |
660 // 32 bit targets do not implement the following instructions. | 664 // 32 bit targets do not implement the following instructions. |
661 #if V8_TARGET_ARCH_32_BIT | 665 #if V8_TARGET_ARCH_32_BIT && V8_TURBOFAN_TARGET |
662 | 666 |
663 void InstructionSelector::VisitWord64And(Node* node) { UNIMPLEMENTED(); } | 667 void InstructionSelector::VisitWord64And(Node* node) { UNIMPLEMENTED(); } |
664 | 668 |
665 | 669 |
666 void InstructionSelector::VisitWord64Or(Node* node) { UNIMPLEMENTED(); } | 670 void InstructionSelector::VisitWord64Or(Node* node) { UNIMPLEMENTED(); } |
667 | 671 |
668 | 672 |
669 void InstructionSelector::VisitWord64Xor(Node* node) { UNIMPLEMENTED(); } | 673 void InstructionSelector::VisitWord64Xor(Node* node) { UNIMPLEMENTED(); } |
670 | 674 |
671 | 675 |
(...skipping 29 matching lines...) Expand all Loading... |
701 | 705 |
702 void InstructionSelector::VisitConvertInt64ToInt32(Node* node) { | 706 void InstructionSelector::VisitConvertInt64ToInt32(Node* node) { |
703 UNIMPLEMENTED(); | 707 UNIMPLEMENTED(); |
704 } | 708 } |
705 | 709 |
706 | 710 |
707 void InstructionSelector::VisitConvertInt32ToInt64(Node* node) { | 711 void InstructionSelector::VisitConvertInt32ToInt64(Node* node) { |
708 UNIMPLEMENTED(); | 712 UNIMPLEMENTED(); |
709 } | 713 } |
710 | 714 |
| 715 #endif // V8_TARGET_ARCH_32_BIT && V8_TURBOFAN_TARGET |
| 716 |
| 717 |
| 718 // 32-bit targets and unsupported architectures need dummy implementations of |
| 719 // selected 64-bit ops. |
| 720 #if V8_TARGET_ARCH_32_BIT || !V8_TURBOFAN_TARGET |
711 | 721 |
712 void InstructionSelector::VisitWord64Test(Node* node, FlagsContinuation* cont) { | 722 void InstructionSelector::VisitWord64Test(Node* node, FlagsContinuation* cont) { |
713 UNIMPLEMENTED(); | 723 UNIMPLEMENTED(); |
714 } | 724 } |
715 | 725 |
716 | 726 |
717 void InstructionSelector::VisitWord64Compare(Node* node, | 727 void InstructionSelector::VisitWord64Compare(Node* node, |
718 FlagsContinuation* cont) { | 728 FlagsContinuation* cont) { |
719 UNIMPLEMENTED(); | 729 UNIMPLEMENTED(); |
720 } | 730 } |
721 | 731 |
722 #endif // V8_TARGET_ARCH_32_BIT | 732 #endif // V8_TARGET_ARCH_32_BIT || !V8_TURBOFAN_TARGET |
723 | 733 |
724 | 734 |
725 void InstructionSelector::VisitPhi(Node* node) { | 735 void InstructionSelector::VisitPhi(Node* node) { |
726 // TODO(bmeurer): Emit a PhiInstruction here. | 736 // TODO(bmeurer): Emit a PhiInstruction here. |
727 for (InputIter i = node->inputs().begin(); i != node->inputs().end(); ++i) { | 737 for (InputIter i = node->inputs().begin(); i != node->inputs().end(); ++i) { |
728 MarkAsUsed(*i); | 738 MarkAsUsed(*i); |
729 } | 739 } |
730 } | 740 } |
731 | 741 |
732 | 742 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 ASSERT(deopt->op()->opcode() == IrOpcode::kDeoptimize); | 871 ASSERT(deopt->op()->opcode() == IrOpcode::kDeoptimize); |
862 Node* state = deopt->InputAt(0); | 872 Node* state = deopt->InputAt(0); |
863 ASSERT(state->op()->opcode() == IrOpcode::kFrameState); | 873 ASSERT(state->op()->opcode() == IrOpcode::kFrameState); |
864 FrameStateDescriptor descriptor = OpParameter<FrameStateDescriptor>(state); | 874 FrameStateDescriptor descriptor = OpParameter<FrameStateDescriptor>(state); |
865 // TODO(jarin) We should also add an instruction input for every input to | 875 // TODO(jarin) We should also add an instruction input for every input to |
866 // the framestate node (and recurse for the inlined framestates). | 876 // the framestate node (and recurse for the inlined framestates). |
867 int deoptimization_id = sequence()->AddDeoptimizationEntry(descriptor); | 877 int deoptimization_id = sequence()->AddDeoptimizationEntry(descriptor); |
868 Emit(kArchDeoptimize | MiscField::encode(deoptimization_id), NULL); | 878 Emit(kArchDeoptimize | MiscField::encode(deoptimization_id), NULL); |
869 } | 879 } |
870 | 880 |
| 881 #if !V8_TURBOFAN_TARGET |
| 882 |
| 883 #define DECLARE_UNIMPLEMENTED_SELECTOR(x) \ |
| 884 void InstructionSelector::Visit##x(Node* node) { UNIMPLEMENTED(); } |
| 885 MACHINE_OP_LIST(DECLARE_UNIMPLEMENTED_SELECTOR) |
| 886 #undef DECLARE_UNIMPLEMENTED_SELECTOR |
| 887 |
| 888 |
| 889 void InstructionSelector::VisitWord32Test(Node* node, FlagsContinuation* cont) { |
| 890 UNIMPLEMENTED(); |
| 891 } |
| 892 |
| 893 |
| 894 void InstructionSelector::VisitWord32Compare(Node* node, |
| 895 FlagsContinuation* cont) { |
| 896 UNIMPLEMENTED(); |
| 897 } |
| 898 |
| 899 |
| 900 void InstructionSelector::VisitFloat64Compare(Node* node, |
| 901 FlagsContinuation* cont) { |
| 902 UNIMPLEMENTED(); |
| 903 } |
| 904 |
| 905 |
| 906 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, |
| 907 BasicBlock* deoptimization) {} |
| 908 |
| 909 #endif |
| 910 |
871 } // namespace compiler | 911 } // namespace compiler |
872 } // namespace internal | 912 } // namespace internal |
873 } // namespace v8 | 913 } // namespace v8 |
OLD | NEW |