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 #ifndef V8_COMPILER_INSTRUCTION_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_H_ |
6 #define V8_COMPILER_INSTRUCTION_H_ | 6 #define V8_COMPILER_INSTRUCTION_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <map> | 10 #include <map> |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 ZoneVector<MachineType> types_; | 780 ZoneVector<MachineType> types_; |
781 FrameStateDescriptor* outer_state_; | 781 FrameStateDescriptor* outer_state_; |
782 MaybeHandle<JSFunction> jsfunction_; | 782 MaybeHandle<JSFunction> jsfunction_; |
783 }; | 783 }; |
784 | 784 |
785 std::ostream& operator<<(std::ostream& os, const Constant& constant); | 785 std::ostream& operator<<(std::ostream& os, const Constant& constant); |
786 | 786 |
787 | 787 |
788 class PhiInstruction FINAL : public ZoneObject { | 788 class PhiInstruction FINAL : public ZoneObject { |
789 public: | 789 public: |
790 typedef ZoneVector<InstructionOperand*> Inputs; | 790 typedef ZoneVector<InstructionOperand> Inputs; |
791 | 791 |
792 PhiInstruction(Zone* zone, int virtual_register, size_t reserved_input_count) | 792 PhiInstruction(Zone* zone, int virtual_register, size_t input_count); |
793 : virtual_register_(virtual_register), | 793 |
794 operands_(zone), | 794 void SetInput(size_t offset, int virtual_register); |
795 output_(nullptr), | |
796 inputs_(zone) { | |
797 UnallocatedOperand* output = new (zone) | |
798 UnallocatedOperand(UnallocatedOperand::NONE, virtual_register); | |
799 output_ = output; | |
800 inputs_.reserve(reserved_input_count); | |
801 operands_.reserve(reserved_input_count); | |
802 } | |
803 | 795 |
804 int virtual_register() const { return virtual_register_; } | 796 int virtual_register() const { return virtual_register_; } |
805 const IntVector& operands() const { return operands_; } | 797 const IntVector& operands() const { return operands_; } |
806 | 798 |
807 void Extend(Zone* zone, int virtual_register) { | 799 const InstructionOperand& output() const { return output_; } |
808 UnallocatedOperand* input = new (zone) | 800 InstructionOperand& output() { return output_; } |
809 UnallocatedOperand(UnallocatedOperand::ANY, virtual_register); | |
810 operands_.push_back(virtual_register); | |
811 inputs_.push_back(input); | |
812 } | |
813 | |
814 InstructionOperand* output() const { return output_; } | |
815 const Inputs& inputs() const { return inputs_; } | 801 const Inputs& inputs() const { return inputs_; } |
816 Inputs& inputs() { return inputs_; } | 802 Inputs& inputs() { return inputs_; } |
817 | 803 |
818 private: | 804 private: |
819 // TODO(dcarney): some of these fields are only for verification, move them to | 805 // TODO(dcarney): some of these fields are only for verification, move them to |
820 // verifier. | 806 // verifier. |
821 const int virtual_register_; | 807 const int virtual_register_; |
| 808 InstructionOperand output_; |
822 IntVector operands_; | 809 IntVector operands_; |
823 InstructionOperand* output_; | |
824 Inputs inputs_; | 810 Inputs inputs_; |
825 }; | 811 }; |
826 | 812 |
827 | 813 |
828 // Analogue of BasicBlock for Instructions instead of Nodes. | 814 // Analogue of BasicBlock for Instructions instead of Nodes. |
829 class InstructionBlock FINAL : public ZoneObject { | 815 class InstructionBlock FINAL : public ZoneObject { |
830 public: | 816 public: |
831 InstructionBlock(Zone* zone, BasicBlock::Id id, | 817 InstructionBlock(Zone* zone, BasicBlock::Id id, |
832 BasicBlock::RpoNumber rpo_number, | 818 BasicBlock::RpoNumber rpo_number, |
833 BasicBlock::RpoNumber loop_header, | 819 BasicBlock::RpoNumber loop_header, |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 | 1050 |
1065 | 1051 |
1066 std::ostream& operator<<(std::ostream& os, | 1052 std::ostream& operator<<(std::ostream& os, |
1067 const PrintableInstructionSequence& code); | 1053 const PrintableInstructionSequence& code); |
1068 | 1054 |
1069 } // namespace compiler | 1055 } // namespace compiler |
1070 } // namespace internal | 1056 } // namespace internal |
1071 } // namespace v8 | 1057 } // namespace v8 |
1072 | 1058 |
1073 #endif // V8_COMPILER_INSTRUCTION_H_ | 1059 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |