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 // Windows specific stuff. |
47 #ifdef WIN32 | 48 #ifdef WIN32 |
48 | 49 |
| 50 // Microsoft Visual C++ specific stuff. |
| 51 #ifdef _MSC_VER |
| 52 |
49 enum { | 53 enum { |
50 FP_NAN, | 54 FP_NAN, |
51 FP_INFINITE, | 55 FP_INFINITE, |
52 FP_ZERO, | 56 FP_ZERO, |
53 FP_SUBNORMAL, | 57 FP_SUBNORMAL, |
54 FP_NORMAL | 58 FP_NORMAL |
55 }; | 59 }; |
56 | 60 |
57 #define INFINITY HUGE_VAL | 61 #define INFINITY HUGE_VAL |
58 | 62 |
59 namespace v8 { namespace internal { | 63 namespace v8 { namespace internal { |
60 int isfinite(double x); | 64 int isfinite(double x); |
61 } } | 65 } } |
62 int isnan(double x); | 66 int isnan(double x); |
63 int isinf(double x); | 67 int isinf(double x); |
64 int isless(double x, double y); | 68 int isless(double x, double y); |
65 int isgreater(double x, double y); | 69 int isgreater(double x, double y); |
66 int fpclassify(double x); | 70 int fpclassify(double x); |
67 int signbit(double x); | 71 int signbit(double x); |
68 | 72 |
| 73 int strncasecmp(const char* s1, const char* s2, int n); |
| 74 |
| 75 #endif // _MSC_VER |
| 76 |
| 77 // MinGW specific stuff. |
| 78 #ifdef __MINGW32__ |
| 79 |
| 80 // Needed for va_list. |
| 81 #include <stdarg.h> |
| 82 |
| 83 #endif // __MINGW32__ |
| 84 |
| 85 // Random is missing on both Visual Studio and MinGW. |
69 int random(); | 86 int random(); |
70 | 87 |
71 int strncasecmp(const char* s1, const char* s2, int n); | 88 #endif // WIN32 |
72 | 89 |
73 #else | 90 // GCC specific stuff |
| 91 #ifdef __GNUC__ |
| 92 #define __GNUC_VERSION__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) |
74 | 93 |
75 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' | 94 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' |
76 // warning flag and certain versions of GCC due to a bug: | 95 // warning flag and certain versions of GCC due to a bug: |
77 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 | 96 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 |
78 // For now, we use the more involved template-based version from <limits>, but | 97 // For now, we use the more involved template-based version from <limits>, but |
79 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) | 98 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) |
80 // __GNUC_PREREQ is not defined in GCC for Mac OS X, so we define our own macro | 99 // __GNUC_PREREQ is not defined in GCC for Mac OS X, so we define our own macro |
81 #if defined(__GNUC__) | |
82 #define __GNUC_VERSION__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) | |
83 #endif | |
84 | |
85 #if __GNUC_VERSION__ >= 29600 && __GNUC_VERSION__ < 40100 | 100 #if __GNUC_VERSION__ >= 29600 && __GNUC_VERSION__ < 40100 |
86 #include <limits> | 101 #include <limits> |
87 #undef INFINITY | 102 #undef INFINITY |
88 #define INFINITY std::numeric_limits<double>::infinity() | 103 #define INFINITY std::numeric_limits<double>::infinity() |
89 #endif | 104 #endif |
90 | 105 |
91 #endif // WIN32 | 106 #endif // __GNUC__ |
92 | 107 |
93 namespace v8 { namespace internal { | 108 namespace v8 { namespace internal { |
94 | 109 |
95 double ceiling(double x); | 110 double ceiling(double x); |
96 | 111 |
97 // ---------------------------------------------------------------------------- | 112 // ---------------------------------------------------------------------------- |
98 // OS | 113 // OS |
99 // | 114 // |
100 // This class has static methods for the different platform specific | 115 // This class has static methods for the different platform specific |
101 // functions. Add methods here to cope with differences between the | 116 // functions. Add methods here to cope with differences between the |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 bool active_; | 455 bool active_; |
441 PlatformData* data_; // Platform specific data. | 456 PlatformData* data_; // Platform specific data. |
442 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 457 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
443 }; | 458 }; |
444 | 459 |
445 #endif // ENABLE_LOGGING_AND_PROFILING | 460 #endif // ENABLE_LOGGING_AND_PROFILING |
446 | 461 |
447 } } // namespace v8::internal | 462 } } // namespace v8::internal |
448 | 463 |
449 #endif // V8_PLATFORM_H_ | 464 #endif // V8_PLATFORM_H_ |
OLD | NEW |