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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #undef INSTRUCTION_OPERAND_PREDICATE | 75 #undef INSTRUCTION_OPERAND_PREDICATE |
76 bool Equals(const InstructionOperand* other) const { | 76 bool Equals(const InstructionOperand* other) const { |
77 return value_ == other->value_; | 77 return value_ == other->value_; |
78 } | 78 } |
79 | 79 |
80 void ConvertTo(Kind kind, int index) { | 80 void ConvertTo(Kind kind, int index) { |
81 DCHECK(kind != UNALLOCATED && kind != INVALID); | 81 DCHECK(kind != UNALLOCATED && kind != INVALID); |
82 ConvertTo(kind, index, kInvalidVirtualRegister); | 82 ConvertTo(kind, index, kInvalidVirtualRegister); |
83 } | 83 } |
84 | 84 |
| 85 // Useful for map/set keys. |
| 86 bool operator<(const InstructionOperand& op) const { |
| 87 return value_ < op.value_; |
| 88 } |
| 89 |
85 protected: | 90 protected: |
86 template <typename SubKindOperand> | 91 template <typename SubKindOperand> |
87 static SubKindOperand* New(Zone* zone, const SubKindOperand& op) { | 92 static SubKindOperand* New(Zone* zone, const SubKindOperand& op) { |
88 void* buffer = zone->New(sizeof(op)); | 93 void* buffer = zone->New(sizeof(op)); |
89 return new (buffer) SubKindOperand(op); | 94 return new (buffer) SubKindOperand(op); |
90 } | 95 } |
91 | 96 |
92 InstructionOperand(Kind kind, int index, int virtual_register) { | 97 InstructionOperand(Kind kind, int index, int virtual_register) { |
93 ConvertTo(kind, index, virtual_register); | 98 ConvertTo(kind, index, virtual_register); |
94 } | 99 } |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 | 1067 |
1063 | 1068 |
1064 std::ostream& operator<<(std::ostream& os, | 1069 std::ostream& operator<<(std::ostream& os, |
1065 const PrintableInstructionSequence& code); | 1070 const PrintableInstructionSequence& code); |
1066 | 1071 |
1067 } // namespace compiler | 1072 } // namespace compiler |
1068 } // namespace internal | 1073 } // namespace internal |
1069 } // namespace v8 | 1074 } // namespace v8 |
1070 | 1075 |
1071 #endif // V8_COMPILER_INSTRUCTION_H_ | 1076 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |