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...) 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) \ | |
titzer
2016/03/07 10:38:11
You should use a do { .. } while(false) to be a go
| |
325 volatile float tmp = lhs; \ | |
326 CheckFloatEq(tmp, rhs); | |
327 | |
324 static inline void CheckDoubleEq(volatile double x, volatile double y) { | 328 static inline void CheckDoubleEq(volatile double x, volatile double y) { |
325 if (std::isnan(x)) { | 329 if (std::isnan(x)) { |
326 CHECK(std::isnan(y)); | 330 CHECK(std::isnan(y)); |
327 } else { | 331 } else { |
328 CHECK_EQ(x, y); | 332 CHECK_EQ(x, y); |
329 } | 333 } |
330 } | 334 } |
331 | 335 |
336 #define CHECK_DOUBLE_EQ(lhs, rhs) \ | |
337 volatile double tmp = lhs; \ | |
338 CheckDoubleEq(tmp, rhs); | |
339 | |
332 } // namespace compiler | 340 } // namespace compiler |
333 } // namespace internal | 341 } // namespace internal |
334 } // namespace v8 | 342 } // namespace v8 |
335 | 343 |
336 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 344 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
OLD | NEW |