OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 26 matching lines...) Expand all Loading... |
37 // the platform dependent classes could have been implemented using abstract | 37 // the platform dependent classes could have been implemented using abstract |
38 // superclasses with virtual methods and having specializations for each | 38 // superclasses with virtual methods and having specializations for each |
39 // platform. This design was rejected because it was more complicated and | 39 // platform. This design was rejected because it was more complicated and |
40 // slower. It would require factory methods for selecting the right | 40 // slower. It would require factory methods for selecting the right |
41 // implementation and the overhead of virtual methods for performance | 41 // implementation and the overhead of virtual methods for performance |
42 // sensitive like mutex locking/unlocking. | 42 // sensitive like mutex locking/unlocking. |
43 | 43 |
44 #ifndef V8_PLATFORM_H_ | 44 #ifndef V8_PLATFORM_H_ |
45 #define V8_PLATFORM_H_ | 45 #define V8_PLATFORM_H_ |
46 | 46 |
| 47 #define V8_INFINITY INFINITY |
| 48 |
47 // Windows specific stuff. | 49 // Windows specific stuff. |
48 #ifdef WIN32 | 50 #ifdef WIN32 |
49 | 51 |
50 // Microsoft Visual C++ specific stuff. | 52 // Microsoft Visual C++ specific stuff. |
51 #ifdef _MSC_VER | 53 #ifdef _MSC_VER |
52 | 54 |
53 enum { | 55 enum { |
54 FP_NAN, | 56 FP_NAN, |
55 FP_INFINITE, | 57 FP_INFINITE, |
56 FP_ZERO, | 58 FP_ZERO, |
57 FP_SUBNORMAL, | 59 FP_SUBNORMAL, |
58 FP_NORMAL | 60 FP_NORMAL |
59 }; | 61 }; |
60 | 62 |
61 #define INFINITY HUGE_VAL | 63 #undef V8_INFINITY |
| 64 #define V8_INFINITY HUGE_VAL |
62 | 65 |
63 namespace v8 { | 66 namespace v8 { |
64 namespace internal { | 67 namespace internal { |
65 int isfinite(double x); | 68 int isfinite(double x); |
66 } } | 69 } } |
67 int isnan(double x); | 70 int isnan(double x); |
68 int isinf(double x); | 71 int isinf(double x); |
69 int isless(double x, double y); | 72 int isless(double x, double y); |
70 int isgreater(double x, double y); | 73 int isgreater(double x, double y); |
71 int fpclassify(double x); | 74 int fpclassify(double x); |
(...skipping 21 matching lines...) Expand all Loading... |
93 #define __GNUC_VERSION__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) | 96 #define __GNUC_VERSION__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) |
94 | 97 |
95 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' | 98 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' |
96 // warning flag and certain versions of GCC due to a bug: | 99 // warning flag and certain versions of GCC due to a bug: |
97 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 | 100 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 |
98 // For now, we use the more involved template-based version from <limits>, but | 101 // For now, we use the more involved template-based version from <limits>, but |
99 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) | 102 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) |
100 // __GNUC_PREREQ is not defined in GCC for Mac OS X, so we define our own macro | 103 // __GNUC_PREREQ is not defined in GCC for Mac OS X, so we define our own macro |
101 #if __GNUC_VERSION__ >= 29600 && __GNUC_VERSION__ < 40100 | 104 #if __GNUC_VERSION__ >= 29600 && __GNUC_VERSION__ < 40100 |
102 #include <limits> | 105 #include <limits> |
103 #undef INFINITY | 106 #undef V8_INFINITY |
104 #define INFINITY std::numeric_limits<double>::infinity() | 107 #define V8_INFINITY std::numeric_limits<double>::infinity() |
105 #endif | 108 #endif |
106 | 109 |
107 #endif // __GNUC__ | 110 #endif // __GNUC__ |
108 | 111 |
109 namespace v8 { | 112 namespace v8 { |
110 namespace internal { | 113 namespace internal { |
111 | 114 |
112 class Semaphore; | 115 class Semaphore; |
113 | 116 |
114 double ceiling(double x); | 117 double ceiling(double x); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 bool active_; | 536 bool active_; |
534 PlatformData* data_; // Platform specific data. | 537 PlatformData* data_; // Platform specific data. |
535 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 538 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
536 }; | 539 }; |
537 | 540 |
538 #endif // ENABLE_LOGGING_AND_PROFILING | 541 #endif // ENABLE_LOGGING_AND_PROFILING |
539 | 542 |
540 } } // namespace v8::internal | 543 } } // namespace v8::internal |
541 | 544 |
542 #endif // V8_PLATFORM_H_ | 545 #endif // V8_PLATFORM_H_ |
OLD | NEW |