| 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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 return GapInstruction::cast(InstructionAt(index)); | 898 return GapInstruction::cast(InstructionAt(index)); |
| 899 } | 899 } |
| 900 bool IsGapAt(int index) const { return InstructionAt(index)->IsGapMoves(); } | 900 bool IsGapAt(int index) const { return InstructionAt(index)->IsGapMoves(); } |
| 901 Instruction* InstructionAt(int index) const { | 901 Instruction* InstructionAt(int index) const { |
| 902 DCHECK(index >= 0); | 902 DCHECK(index >= 0); |
| 903 DCHECK(index < static_cast<int>(instructions_.size())); | 903 DCHECK(index < static_cast<int>(instructions_.size())); |
| 904 return instructions_[index]; | 904 return instructions_[index]; |
| 905 } | 905 } |
| 906 | 906 |
| 907 Frame* frame() { return &frame_; } | 907 Frame* frame() { return &frame_; } |
| 908 Isolate* isolate() { return zone()->isolate(); } | 908 Isolate* isolate() const { return zone()->isolate(); } |
| 909 Linkage* linkage() const { return linkage_; } | 909 Linkage* linkage() const { return linkage_; } |
| 910 const PointerMapDeque* pointer_maps() const { return &pointer_maps_; } | 910 const PointerMapDeque* pointer_maps() const { return &pointer_maps_; } |
| 911 Zone* zone() { return &zone_; } | 911 Zone* zone() const { return zone_; } |
| 912 | 912 |
| 913 // Used by the instruction selector while adding instructions. | 913 // Used by the instruction selector while adding instructions. |
| 914 int AddInstruction(Instruction* instr); | 914 int AddInstruction(Instruction* instr); |
| 915 void StartBlock(BasicBlock* block); | 915 void StartBlock(BasicBlock* block); |
| 916 void EndBlock(BasicBlock* block); | 916 void EndBlock(BasicBlock* block); |
| 917 | 917 |
| 918 int AddConstant(Node* node, Constant constant) { | 918 int AddConstant(Node* node, Constant constant) { |
| 919 int virtual_register = GetVirtualRegister(node); | 919 int virtual_register = GetVirtualRegister(node); |
| 920 DCHECK(constants_.find(virtual_register) == constants_.end()); | 920 DCHECK(constants_.find(virtual_register) == constants_.end()); |
| 921 constants_.insert(std::make_pair(virtual_register, constant)); | 921 constants_.insert(std::make_pair(virtual_register, constant)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 StateId AddFrameStateDescriptor(FrameStateDescriptor* descriptor); | 955 StateId AddFrameStateDescriptor(FrameStateDescriptor* descriptor); |
| 956 FrameStateDescriptor* GetFrameStateDescriptor(StateId deoptimization_id); | 956 FrameStateDescriptor* GetFrameStateDescriptor(StateId deoptimization_id); |
| 957 int GetFrameStateDescriptorCount(); | 957 int GetFrameStateDescriptorCount(); |
| 958 | 958 |
| 959 private: | 959 private: |
| 960 friend std::ostream& operator<<(std::ostream& os, | 960 friend std::ostream& operator<<(std::ostream& os, |
| 961 const InstructionSequence& code); | 961 const InstructionSequence& code); |
| 962 | 962 |
| 963 typedef std::set<int, std::less<int>, ZoneIntAllocator> VirtualRegisterSet; | 963 typedef std::set<int, std::less<int>, ZoneIntAllocator> VirtualRegisterSet; |
| 964 | 964 |
| 965 Zone zone_; | 965 Zone* zone_; |
| 966 int node_count_; | 966 int node_count_; |
| 967 int* node_map_; | 967 int* node_map_; |
| 968 InstructionBlocks instruction_blocks_; | 968 InstructionBlocks instruction_blocks_; |
| 969 Linkage* linkage_; | 969 Linkage* linkage_; |
| 970 ConstantMap constants_; | 970 ConstantMap constants_; |
| 971 ConstantDeque immediates_; | 971 ConstantDeque immediates_; |
| 972 InstructionDeque instructions_; | 972 InstructionDeque instructions_; |
| 973 int next_virtual_register_; | 973 int next_virtual_register_; |
| 974 PointerMapDeque pointer_maps_; | 974 PointerMapDeque pointer_maps_; |
| 975 VirtualRegisterSet doubles_; | 975 VirtualRegisterSet doubles_; |
| 976 VirtualRegisterSet references_; | 976 VirtualRegisterSet references_; |
| 977 Frame frame_; | 977 Frame frame_; |
| 978 DeoptimizationVector deoptimization_entries_; | 978 DeoptimizationVector deoptimization_entries_; |
| 979 }; | 979 }; |
| 980 | 980 |
| 981 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code); | 981 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code); |
| 982 | 982 |
| 983 } // namespace compiler | 983 } // namespace compiler |
| 984 } // namespace internal | 984 } // namespace internal |
| 985 } // namespace v8 | 985 } // namespace v8 |
| 986 | 986 |
| 987 #endif // V8_COMPILER_INSTRUCTION_H_ | 987 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |