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_CCTEST_COMPILER_VALUE_HELPER_H_ | 5 #ifndef V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
6 #define V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 6 #define V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 // TODO(bmeurer): Drop this crap once we switch to GTest/Gmock. | 315 // TODO(bmeurer): Drop this crap once we switch to GTest/Gmock. |
316 static inline void CheckFloatEq(volatile float x, volatile float y) { | 316 static inline void CheckFloatEq(volatile float x, volatile float y) { |
317 if (std::isnan(x)) { | 317 if (std::isnan(x)) { |
318 CHECK(std::isnan(y)); | 318 CHECK(std::isnan(y)); |
319 } else { | 319 } else { |
320 CHECK_EQ(x, y); | 320 CHECK_EQ(x, y); |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
| 324 #define CHECK_FLOAT_EQ(lhs, rhs) \ |
| 325 do { \ |
| 326 volatile float tmp = lhs; \ |
| 327 CheckFloatEq(tmp, rhs); \ |
| 328 } while (0) |
| 329 |
324 static inline void CheckDoubleEq(volatile double x, volatile double y) { | 330 static inline void CheckDoubleEq(volatile double x, volatile double y) { |
325 if (std::isnan(x)) { | 331 if (std::isnan(x)) { |
326 CHECK(std::isnan(y)); | 332 CHECK(std::isnan(y)); |
327 } else { | 333 } else { |
328 CHECK_EQ(x, y); | 334 CHECK_EQ(x, y); |
329 } | 335 } |
330 } | 336 } |
331 | 337 |
| 338 #define CHECK_DOUBLE_EQ(lhs, rhs) \ |
| 339 do { \ |
| 340 volatile double tmp = lhs; \ |
| 341 CheckDoubleEq(tmp, rhs); \ |
| 342 } while (0) |
| 343 |
332 } // namespace compiler | 344 } // namespace compiler |
333 } // namespace internal | 345 } // namespace internal |
334 } // namespace v8 | 346 } // namespace v8 |
335 | 347 |
336 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 348 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
OLD | NEW |