| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 Hash const hash_; | 165 Hash const hash_; |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 | 168 |
| 169 // Helper to extract parameters from Operator1<*> operator. | 169 // Helper to extract parameters from Operator1<*> operator. |
| 170 template <typename T> | 170 template <typename T> |
| 171 inline T const& OpParameter(const Operator* op) { | 171 inline T const& OpParameter(const Operator* op) { |
| 172 return static_cast<const Operator1<T>*>(op)->parameter(); | 172 return static_cast<const Operator1<T>*>(op)->parameter(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 // NOTE: We have to be careful to use the right equal/hash functions below, for |
| 176 // float/double we always use the ones operating on the bit level. |
| 177 template <> |
| 178 inline float const& OpParameter(const Operator* op) { |
| 179 return static_cast<const Operator1<float, base::bit_equal_to<float>, |
| 180 base::bit_hash<float>>*>(op)->parameter(); |
| 181 } |
| 182 |
| 183 template <> |
| 184 inline double const& OpParameter(const Operator* op) { |
| 185 return static_cast<const Operator1<double, base::bit_equal_to<double>, |
| 186 base::bit_hash<double>>*>(op)->parameter(); |
| 187 } |
| 188 |
| 175 } // namespace compiler | 189 } // namespace compiler |
| 176 } // namespace internal | 190 } // namespace internal |
| 177 } // namespace v8 | 191 } // namespace v8 |
| 178 | 192 |
| 179 #endif // V8_COMPILER_OPERATOR_H_ | 193 #endif // V8_COMPILER_OPERATOR_H_ |
| OLD | NEW |