OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_OPERATOR_H_ | 5 #ifndef V8_COMPILER_OPERATOR_H_ |
6 #define V8_COMPILER_OPERATOR_H_ | 6 #define V8_COMPILER_OPERATOR_H_ |
7 | 7 |
8 #include <ostream> // NOLINT(readability/streams) | 8 #include <ostream> // NOLINT(readability/streams) |
9 | 9 |
10 #include "src/base/flags.h" | 10 #include "src/base/flags.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 size_t value_out, size_t effect_out, size_t control_out, | 146 size_t value_out, size_t effect_out, size_t control_out, |
147 T parameter, Pred const& pred = Pred(), Hash const& hash = Hash()) | 147 T parameter, Pred const& pred = Pred(), Hash const& hash = Hash()) |
148 : Operator(opcode, properties, mnemonic, value_in, effect_in, control_in, | 148 : Operator(opcode, properties, mnemonic, value_in, effect_in, control_in, |
149 value_out, effect_out, control_out), | 149 value_out, effect_out, control_out), |
150 parameter_(parameter), | 150 parameter_(parameter), |
151 pred_(pred), | 151 pred_(pred), |
152 hash_(hash) {} | 152 hash_(hash) {} |
153 | 153 |
154 T const& parameter() const { return parameter_; } | 154 T const& parameter() const { return parameter_; } |
155 | 155 |
156 bool Equals(const Operator* other) const FINAL { | 156 bool Equals(const Operator* other) const final { |
157 if (opcode() != other->opcode()) return false; | 157 if (opcode() != other->opcode()) return false; |
158 const Operator1<T>* that = reinterpret_cast<const Operator1<T>*>(other); | 158 const Operator1<T>* that = reinterpret_cast<const Operator1<T>*>(other); |
159 return this->pred_(this->parameter(), that->parameter()); | 159 return this->pred_(this->parameter(), that->parameter()); |
160 } | 160 } |
161 size_t HashCode() const FINAL { | 161 size_t HashCode() const final { |
162 return base::hash_combine(this->opcode(), this->hash_(this->parameter())); | 162 return base::hash_combine(this->opcode(), this->hash_(this->parameter())); |
163 } | 163 } |
164 virtual void PrintParameter(std::ostream& os) const { | 164 virtual void PrintParameter(std::ostream& os) const { |
165 os << "[" << this->parameter() << "]"; | 165 os << "[" << this->parameter() << "]"; |
166 } | 166 } |
167 | 167 |
168 protected: | 168 protected: |
169 void PrintTo(std::ostream& os) const FINAL { | 169 void PrintTo(std::ostream& os) const final { |
170 os << mnemonic(); | 170 os << mnemonic(); |
171 PrintParameter(os); | 171 PrintParameter(os); |
172 } | 172 } |
173 | 173 |
174 private: | 174 private: |
175 T const parameter_; | 175 T const parameter_; |
176 Pred const pred_; | 176 Pred const pred_; |
177 Hash const hash_; | 177 Hash const hash_; |
178 }; | 178 }; |
179 | 179 |
(...skipping 18 matching lines...) Expand all Loading... |
198 return reinterpret_cast<const Operator1<double, base::bit_equal_to<double>, | 198 return reinterpret_cast<const Operator1<double, base::bit_equal_to<double>, |
199 base::bit_hash<double>>*>(op) | 199 base::bit_hash<double>>*>(op) |
200 ->parameter(); | 200 ->parameter(); |
201 } | 201 } |
202 | 202 |
203 } // namespace compiler | 203 } // namespace compiler |
204 } // namespace internal | 204 } // namespace internal |
205 } // namespace v8 | 205 } // namespace v8 |
206 | 206 |
207 #endif // V8_COMPILER_OPERATOR_H_ | 207 #endif // V8_COMPILER_OPERATOR_H_ |
OLD | NEW |