OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include <string.h> | 32 #include <string.h> |
33 | 33 |
34 #include <assert.h> | 34 #include <assert.h> |
35 #ifndef ASSERT | 35 #ifndef ASSERT |
36 #define ASSERT(condition) \ | 36 #define ASSERT(condition) \ |
37 assert(condition); | 37 assert(condition); |
38 #endif | 38 #endif |
39 #ifndef UNIMPLEMENTED | 39 #ifndef UNIMPLEMENTED |
40 #define UNIMPLEMENTED() (abort()) | 40 #define UNIMPLEMENTED() (abort()) |
41 #endif | 41 #endif |
| 42 #ifndef DOUBLE_CONVERSION_NO_RETURN |
| 43 #ifdef _MSC_VER |
| 44 #define DOUBLE_CONVERSION_NO_RETURN __declspec(noreturn) |
| 45 #else |
| 46 #define DOUBLE_CONVERSION_NO_RETURN __attribute__((noreturn)) |
| 47 #endif |
| 48 #endif |
42 #ifndef UNREACHABLE | 49 #ifndef UNREACHABLE |
| 50 #ifdef _MSC_VER |
| 51 void DOUBLE_CONVERSION_NO_RETURN abort_noreturn(); |
| 52 inline void abort_noreturn() { abort(); } |
| 53 #define UNREACHABLE() (abort_noreturn()) |
| 54 #else |
43 #define UNREACHABLE() (abort()) | 55 #define UNREACHABLE() (abort()) |
44 #endif | 56 #endif |
| 57 #endif |
| 58 |
45 | 59 |
46 // Double operations detection based on target architecture. | 60 // Double operations detection based on target architecture. |
47 // Linux uses a 80bit wide floating point stack on x86. This induces double | 61 // Linux uses a 80bit wide floating point stack on x86. This induces double |
48 // rounding, which in turn leads to wrong results. | 62 // rounding, which in turn leads to wrong results. |
49 // An easy way to test if the floating-point operations are correct is to | 63 // An easy way to test if the floating-point operations are correct is to |
50 // evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then | 64 // evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then |
51 // the result is equal to 89255e-22. | 65 // the result is equal to 89255e-22. |
52 // The best way to test this, is to create a division-function and to compare | 66 // The best way to test this, is to create a division-function and to compare |
53 // the output of the division with the expected result. (Inlining must be | 67 // the output of the division with the expected result. (Inlining must be |
54 // disabled.) | 68 // disabled.) |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } | 332 } |
319 | 333 |
320 template <class Dest, class Source> | 334 template <class Dest, class Source> |
321 inline Dest BitCast(Source* source) { | 335 inline Dest BitCast(Source* source) { |
322 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); | 336 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); |
323 } | 337 } |
324 | 338 |
325 } // namespace double_conversion | 339 } // namespace double_conversion |
326 | 340 |
327 #endif // DOUBLE_CONVERSION_UTILS_H_ | 341 #endif // DOUBLE_CONVERSION_UTILS_H_ |
OLD | NEW |