| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 if ((intgr & 1) != 0 && intgr - flt == 0.5) { | 79 if ((intgr & 1) != 0 && intgr - flt == 0.5) { |
| 80 // If the number is halfway between two integers, round to the even one. | 80 // If the number is halfway between two integers, round to the even one. |
| 81 intgr--; | 81 intgr--; |
| 82 } | 82 } |
| 83 #endif | 83 #endif |
| 84 return intgr; | 84 return intgr; |
| 85 } | 85 } |
| 86 | 86 |
| 87 #endif // V8_CC_MSVC | 87 #endif // V8_CC_MSVC |
| 88 | 88 |
| 89 // Random is missing on both Visual Studio and MinGW. | |
| 90 #if V8_CC_MSVC || V8_CC_MINGW | |
| 91 int random(); | |
| 92 #endif // V8_CC_MSVC || V8_CC_MINGW | |
| 93 | |
| 94 namespace v8 { | 89 namespace v8 { |
| 95 namespace internal { | 90 namespace internal { |
| 96 | 91 |
| 97 double ceiling(double x); | 92 double ceiling(double x); |
| 98 double modulo(double x, double y); | 93 double modulo(double x, double y); |
| 99 | 94 |
| 100 // Custom implementation of math functions. | 95 // Custom implementation of math functions. |
| 101 double fast_sin(double input); | 96 double fast_sin(double input); |
| 102 double fast_cos(double input); | 97 double fast_cos(double input); |
| 103 double fast_tan(double input); | 98 double fast_tan(double input); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 159 |
| 165 // ---------------------------------------------------------------------------- | 160 // ---------------------------------------------------------------------------- |
| 166 // OS | 161 // OS |
| 167 // | 162 // |
| 168 // This class has static methods for the different platform specific | 163 // This class has static methods for the different platform specific |
| 169 // functions. Add methods here to cope with differences between the | 164 // functions. Add methods here to cope with differences between the |
| 170 // supported platforms. | 165 // supported platforms. |
| 171 | 166 |
| 172 class OS { | 167 class OS { |
| 173 public: | 168 public: |
| 174 // Initializes the platform OS support. Called once at VM startup. | |
| 175 static void SetUp(); | |
| 176 | |
| 177 // Initializes the platform OS support that depend on CPU features. This is | 169 // Initializes the platform OS support that depend on CPU features. This is |
| 178 // called after CPU initialization. | 170 // called after CPU initialization. |
| 179 static void PostSetUp(); | 171 static void PostSetUp(); |
| 180 | 172 |
| 181 // Returns the accumulated user time for thread. This routine | 173 // Returns the accumulated user time for thread. This routine |
| 182 // can be used for profiling. The implementation should | 174 // can be used for profiling. The implementation should |
| 183 // strive for high-precision timer resolution, preferable | 175 // strive for high-precision timer resolution, preferable |
| 184 // micro-second resolution. | 176 // micro-second resolution. |
| 185 static int GetUserTime(uint32_t* secs, uint32_t* usecs); | 177 static int GetUserTime(uint32_t* secs, uint32_t* usecs); |
| 186 | 178 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 static int SNPrintF(Vector<char> str, const char* format, ...); | 280 static int SNPrintF(Vector<char> str, const char* format, ...); |
| 289 static int VSNPrintF(Vector<char> str, | 281 static int VSNPrintF(Vector<char> str, |
| 290 const char* format, | 282 const char* format, |
| 291 va_list args); | 283 va_list args); |
| 292 | 284 |
| 293 static char* StrChr(char* str, int c); | 285 static char* StrChr(char* str, int c); |
| 294 static void StrNCpy(Vector<char> dest, const char* src, size_t n); | 286 static void StrNCpy(Vector<char> dest, const char* src, size_t n); |
| 295 | 287 |
| 296 // Support for the profiler. Can do nothing, in which case ticks | 288 // Support for the profiler. Can do nothing, in which case ticks |
| 297 // occuring in shared libraries will not be properly accounted for. | 289 // occuring in shared libraries will not be properly accounted for. |
| 298 static void LogSharedLibraryAddresses(); | 290 static void LogSharedLibraryAddresses(Isolate* isolate); |
| 299 | 291 |
| 300 // Support for the profiler. Notifies the external profiling | 292 // Support for the profiler. Notifies the external profiling |
| 301 // process that a code moving garbage collection starts. Can do | 293 // process that a code moving garbage collection starts. Can do |
| 302 // nothing, in which case the code objects must not move (e.g., by | 294 // nothing, in which case the code objects must not move (e.g., by |
| 303 // using --never-compact) if accurate profiling is desired. | 295 // using --never-compact) if accurate profiling is desired. |
| 304 static void SignalCodeMovingGC(); | 296 static void SignalCodeMovingGC(); |
| 305 | 297 |
| 306 // The return value indicates the CPU features we are sure of because of the | 298 // The return value indicates the CPU features we are sure of because of the |
| 307 // OS. For example MacOSX doesn't run on any x86 CPUs that don't have SSE2 | 299 // OS. For example MacOSX doesn't run on any x86 CPUs that don't have SSE2 |
| 308 // instructions. | 300 // instructions. |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 char name_[kMaxThreadNameLength]; | 590 char name_[kMaxThreadNameLength]; |
| 599 int stack_size_; | 591 int stack_size_; |
| 600 Semaphore* start_semaphore_; | 592 Semaphore* start_semaphore_; |
| 601 | 593 |
| 602 DISALLOW_COPY_AND_ASSIGN(Thread); | 594 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 603 }; | 595 }; |
| 604 | 596 |
| 605 } } // namespace v8::internal | 597 } } // namespace v8::internal |
| 606 | 598 |
| 607 #endif // V8_PLATFORM_H_ | 599 #endif // V8_PLATFORM_H_ |
| OLD | NEW |