| 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" |
| 11 #include "src/base/functional.h" | 11 #include "src/base/functional.h" |
| 12 #include "src/base/macros.h" |
| 12 #include "src/zone.h" | 13 #include "src/zone.h" |
| 13 | 14 |
| 14 namespace v8 { | 15 namespace v8 { |
| 15 namespace internal { | 16 namespace internal { |
| 16 namespace compiler { | 17 namespace compiler { |
| 17 | 18 |
| 18 // An operator represents description of the "computation" of a node in the | 19 // An operator represents description of the "computation" of a node in the |
| 19 // compiler IR. A computation takes values (i.e. data) as input and produces | 20 // compiler IR. A computation takes values (i.e. data) as input and produces |
| 20 // zero or more values as output. The side-effects of a computation must be | 21 // zero or more values as output. The side-effects of a computation must be |
| 21 // captured by additional control and data dependencies which are part of the | 22 // captured by additional control and data dependencies which are part of the |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 174 |
| 174 private: | 175 private: |
| 175 T const parameter_; | 176 T const parameter_; |
| 176 Pred const pred_; | 177 Pred const pred_; |
| 177 Hash const hash_; | 178 Hash const hash_; |
| 178 }; | 179 }; |
| 179 | 180 |
| 180 | 181 |
| 181 // Helper to extract parameters from Operator1<*> operator. | 182 // Helper to extract parameters from Operator1<*> operator. |
| 182 template <typename T> | 183 template <typename T> |
| 184 DISABLE_CFI_UNRELATED_CAST |
| 183 inline T const& OpParameter(const Operator* op) { | 185 inline T const& OpParameter(const Operator* op) { |
| 184 return reinterpret_cast<const Operator1<T>*>(op)->parameter(); | 186 return reinterpret_cast<const Operator1<T>*>(op)->parameter(); |
| 185 } | 187 } |
| 186 | 188 |
| 187 // NOTE: We have to be careful to use the right equal/hash functions below, for | 189 // NOTE: We have to be careful to use the right equal/hash functions below, for |
| 188 // float/double we always use the ones operating on the bit level. | 190 // float/double we always use the ones operating on the bit level. |
| 189 template <> | 191 template <> |
| 190 inline float const& OpParameter(const Operator* op) { | 192 inline float const& OpParameter(const Operator* op) { |
| 191 return reinterpret_cast<const Operator1<float, base::bit_equal_to<float>, | 193 return reinterpret_cast<const Operator1<float, base::bit_equal_to<float>, |
| 192 base::bit_hash<float>>*>(op) | 194 base::bit_hash<float>>*>(op) |
| 193 ->parameter(); | 195 ->parameter(); |
| 194 } | 196 } |
| 195 | 197 |
| 196 template <> | 198 template <> |
| 197 inline double const& OpParameter(const Operator* op) { | 199 inline double const& OpParameter(const Operator* op) { |
| 198 return reinterpret_cast<const Operator1<double, base::bit_equal_to<double>, | 200 return reinterpret_cast<const Operator1<double, base::bit_equal_to<double>, |
| 199 base::bit_hash<double>>*>(op) | 201 base::bit_hash<double>>*>(op) |
| 200 ->parameter(); | 202 ->parameter(); |
| 201 } | 203 } |
| 202 | 204 |
| 203 } // namespace compiler | 205 } // namespace compiler |
| 204 } // namespace internal | 206 } // namespace internal |
| 205 } // namespace v8 | 207 } // namespace v8 |
| 206 | 208 |
| 207 #endif // V8_COMPILER_OPERATOR_H_ | 209 #endif // V8_COMPILER_OPERATOR_H_ |
| OLD | NEW |