| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include <cstdarg> |
| 48 |
| 49 #include "lazy-instance.h" |
| 50 #include "utils.h" |
| 51 #include "v8globals.h" |
| 52 |
| 47 #ifdef __sun | 53 #ifdef __sun |
| 48 # ifndef signbit | 54 # ifndef signbit |
| 49 namespace std { | 55 namespace std { |
| 50 int signbit(double x); | 56 int signbit(double x); |
| 51 } | 57 } |
| 52 # endif | 58 # endif |
| 53 #endif | 59 #endif |
| 54 | 60 |
| 55 // GCC specific stuff | 61 // GCC specific stuff |
| 56 #ifdef __GNUC__ | 62 #ifdef __GNUC__ |
| 57 | 63 |
| 58 // Needed for va_list on at least MinGW and Android. | |
| 59 #include <stdarg.h> | |
| 60 | |
| 61 #define __GNUC_VERSION__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) | 64 #define __GNUC_VERSION__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) |
| 62 | 65 |
| 63 #endif // __GNUC__ | 66 #endif // __GNUC__ |
| 64 | 67 |
| 65 | |
| 66 // Windows specific stuff. | |
| 67 #ifdef WIN32 | |
| 68 | |
| 69 // Microsoft Visual C++ specific stuff. | 68 // Microsoft Visual C++ specific stuff. |
| 70 #ifdef _MSC_VER | 69 #if V8_CC_MSVC |
| 71 | 70 |
| 72 #include "win32-headers.h" | 71 #include "win32-headers.h" |
| 73 #include "win32-math.h" | 72 #include "win32-math.h" |
| 74 | 73 |
| 75 int strncasecmp(const char* s1, const char* s2, int n); | 74 int strncasecmp(const char* s1, const char* s2, int n); |
| 76 | 75 |
| 77 inline int lrint(double flt) { | 76 inline int lrint(double flt) { |
| 78 int intgr; | 77 int intgr; |
| 79 #if defined(V8_TARGET_ARCH_IA32) | 78 #if V8_TARGET_ARCH_IA32 |
| 80 __asm { | 79 __asm { |
| 81 fld flt | 80 fld flt |
| 82 fistp intgr | 81 fistp intgr |
| 83 }; | 82 }; |
| 84 #else | 83 #else |
| 85 intgr = static_cast<int>(flt + 0.5); | 84 intgr = static_cast<int>(flt + 0.5); |
| 86 if ((intgr & 1) != 0 && intgr - flt == 0.5) { | 85 if ((intgr & 1) != 0 && intgr - flt == 0.5) { |
| 87 // If the number is halfway between two integers, round to the even one. | 86 // If the number is halfway between two integers, round to the even one. |
| 88 intgr--; | 87 intgr--; |
| 89 } | 88 } |
| 90 #endif | 89 #endif |
| 91 return intgr; | 90 return intgr; |
| 92 } | 91 } |
| 93 | 92 |
| 94 #endif // _MSC_VER | 93 #endif // V8_CC_MSVC |
| 95 | 94 |
| 96 #ifndef __CYGWIN__ | |
| 97 // Random is missing on both Visual Studio and MinGW. | 95 // Random is missing on both Visual Studio and MinGW. |
| 96 #if V8_CC_MSVC || V8_CC_MINGW |
| 98 int random(); | 97 int random(); |
| 99 #endif | 98 #endif // V8_CC_MSVC || V8_CC_MINGW |
| 100 | |
| 101 #endif // WIN32 | |
| 102 | |
| 103 #include "lazy-instance.h" | |
| 104 #include "utils.h" | |
| 105 #include "v8globals.h" | |
| 106 | 99 |
| 107 namespace v8 { | 100 namespace v8 { |
| 108 namespace internal { | 101 namespace internal { |
| 109 | 102 |
| 110 class Semaphore; | 103 class Semaphore; |
| 111 class Mutex; | 104 class Mutex; |
| 112 | 105 |
| 113 double ceiling(double x); | 106 double ceiling(double x); |
| 114 double modulo(double x, double y); | 107 double modulo(double x, double y); |
| 115 | 108 |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 static uint16_t HToN(uint16_t value); | 798 static uint16_t HToN(uint16_t value); |
| 806 static uint16_t NToH(uint16_t value); | 799 static uint16_t NToH(uint16_t value); |
| 807 static uint32_t HToN(uint32_t value); | 800 static uint32_t HToN(uint32_t value); |
| 808 static uint32_t NToH(uint32_t value); | 801 static uint32_t NToH(uint32_t value); |
| 809 }; | 802 }; |
| 810 | 803 |
| 811 | 804 |
| 812 } } // namespace v8::internal | 805 } } // namespace v8::internal |
| 813 | 806 |
| 814 #endif // V8_PLATFORM_H_ | 807 #endif // V8_PLATFORM_H_ |
| OLD | NEW |