| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 | 47 #ifdef __sun |
| 48 # ifndef signbit |
| 49 int signbit(double x); |
| 50 # endif |
| 51 #endif |
| 52 |
| 53 // GCC specific stuff |
| 54 #ifdef __GNUC__ |
| 55 |
| 56 // Needed for va_list on at least MinGW and Android. |
| 57 #include <stdarg.h> |
| 58 |
| 59 #define __GNUC_VERSION__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) |
| 60 |
| 61 #endif // __GNUC__ |
| 62 |
| 48 | 63 |
| 49 // Windows specific stuff. | 64 // Windows specific stuff. |
| 50 #ifdef WIN32 | 65 #ifdef WIN32 |
| 51 | 66 |
| 52 // Microsoft Visual C++ specific stuff. | 67 // Microsoft Visual C++ specific stuff. |
| 53 #ifdef _MSC_VER | 68 #ifdef _MSC_VER |
| 54 | 69 |
| 55 enum { | 70 #include "win32-math.h" |
| 56 FP_NAN, | |
| 57 FP_INFINITE, | |
| 58 FP_ZERO, | |
| 59 FP_SUBNORMAL, | |
| 60 FP_NORMAL | |
| 61 }; | |
| 62 | |
| 63 #undef V8_INFINITY | |
| 64 #define V8_INFINITY HUGE_VAL | |
| 65 | |
| 66 namespace v8 { | |
| 67 namespace internal { | |
| 68 int isfinite(double x); | |
| 69 } } | |
| 70 int isnan(double x); | |
| 71 int isinf(double x); | |
| 72 int isless(double x, double y); | |
| 73 int isgreater(double x, double y); | |
| 74 int fpclassify(double x); | |
| 75 int signbit(double x); | |
| 76 | 71 |
| 77 int strncasecmp(const char* s1, const char* s2, int n); | 72 int strncasecmp(const char* s1, const char* s2, int n); |
| 78 | 73 |
| 79 #endif // _MSC_VER | 74 #endif // _MSC_VER |
| 80 | 75 |
| 81 // Random is missing on both Visual Studio and MinGW. | 76 // Random is missing on both Visual Studio and MinGW. |
| 82 int random(); | 77 int random(); |
| 83 | 78 |
| 84 #endif // WIN32 | 79 #endif // WIN32 |
| 85 | 80 |
| 86 | |
| 87 #ifdef __sun | |
| 88 # ifndef signbit | |
| 89 int signbit(double x); | |
| 90 # endif | |
| 91 #endif | |
| 92 | |
| 93 | |
| 94 // GCC specific stuff | |
| 95 #ifdef __GNUC__ | |
| 96 | |
| 97 // Needed for va_list on at least MinGW and Android. | |
| 98 #include <stdarg.h> | |
| 99 | |
| 100 #define __GNUC_VERSION__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) | |
| 101 | |
| 102 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' | |
| 103 // warning flag and certain versions of GCC due to a bug: | |
| 104 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 | |
| 105 // For now, we use the more involved template-based version from <limits>, but | |
| 106 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) | |
| 107 // __GNUC_PREREQ is not defined in GCC for Mac OS X, so we define our own macro | |
| 108 #if __GNUC_VERSION__ >= 29600 && __GNUC_VERSION__ < 40100 | |
| 109 #include <limits> | |
| 110 #undef V8_INFINITY | |
| 111 #define V8_INFINITY std::numeric_limits<double>::infinity() | |
| 112 #endif | |
| 113 | |
| 114 #endif // __GNUC__ | |
| 115 | |
| 116 #include "atomicops.h" | 81 #include "atomicops.h" |
| 117 #include "platform-tls.h" | 82 #include "platform-tls.h" |
| 118 #include "utils.h" | 83 #include "utils.h" |
| 119 #include "v8globals.h" | 84 #include "v8globals.h" |
| 120 | 85 |
| 121 namespace v8 { | 86 namespace v8 { |
| 122 namespace internal { | 87 namespace internal { |
| 123 | 88 |
| 124 // Use AtomicWord for a machine-sized pointer. It is assumed that | 89 // Use AtomicWord for a machine-sized pointer. It is assumed that |
| 125 // reads and writes of naturally aligned values of this type are atomic. | 90 // reads and writes of naturally aligned values of this type are atomic. |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 Atomic32 active_; | 626 Atomic32 active_; |
| 662 PlatformData* data_; // Platform specific data. | 627 PlatformData* data_; // Platform specific data. |
| 663 int samples_taken_; // Counts stack samples taken. | 628 int samples_taken_; // Counts stack samples taken. |
| 664 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 629 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 665 }; | 630 }; |
| 666 | 631 |
| 667 | 632 |
| 668 } } // namespace v8::internal | 633 } } // namespace v8::internal |
| 669 | 634 |
| 670 #endif // V8_PLATFORM_H_ | 635 #endif // V8_PLATFORM_H_ |
| OLD | NEW |