| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 // Microsoft Visual C++ specific stuff. | 62 // Microsoft Visual C++ specific stuff. |
| 63 #if V8_CC_MSVC | 63 #if V8_CC_MSVC |
| 64 | 64 |
| 65 #include "win32-headers.h" | 65 #include "win32-headers.h" |
| 66 #include "win32-math.h" | 66 #include "win32-math.h" |
| 67 | 67 |
| 68 int strncasecmp(const char* s1, const char* s2, int n); | 68 int strncasecmp(const char* s1, const char* s2, int n); |
| 69 | 69 |
| 70 // Visual C++ 2013 and higher implement this function. |
| 71 #if (_MSC_VER < 1800) |
| 70 inline int lrint(double flt) { | 72 inline int lrint(double flt) { |
| 71 int intgr; | 73 int intgr; |
| 72 #if V8_TARGET_ARCH_IA32 | 74 #if V8_TARGET_ARCH_IA32 |
| 73 __asm { | 75 __asm { |
| 74 fld flt | 76 fld flt |
| 75 fistp intgr | 77 fistp intgr |
| 76 }; | 78 }; |
| 77 #else | 79 #else |
| 78 intgr = static_cast<int>(flt + 0.5); | 80 intgr = static_cast<int>(flt + 0.5); |
| 79 if ((intgr & 1) != 0 && intgr - flt == 0.5) { | 81 if ((intgr & 1) != 0 && intgr - flt == 0.5) { |
| 80 // If the number is halfway between two integers, round to the even one. | 82 // If the number is halfway between two integers, round to the even one. |
| 81 intgr--; | 83 intgr--; |
| 82 } | 84 } |
| 83 #endif | 85 #endif |
| 84 return intgr; | 86 return intgr; |
| 85 } | 87 } |
| 86 | 88 |
| 89 #endif // _MSC_VER < 1800 |
| 90 |
| 87 #endif // V8_CC_MSVC | 91 #endif // V8_CC_MSVC |
| 88 | 92 |
| 89 namespace v8 { | 93 namespace v8 { |
| 90 namespace internal { | 94 namespace internal { |
| 91 | 95 |
| 92 double ceiling(double x); | 96 double ceiling(double x); |
| 93 double modulo(double x, double y); | 97 double modulo(double x, double y); |
| 94 | 98 |
| 95 // Custom implementation of math functions. | 99 // Custom implementation of math functions. |
| 96 double fast_sin(double input); | 100 double fast_sin(double input); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 char name_[kMaxThreadNameLength]; | 592 char name_[kMaxThreadNameLength]; |
| 589 int stack_size_; | 593 int stack_size_; |
| 590 Semaphore* start_semaphore_; | 594 Semaphore* start_semaphore_; |
| 591 | 595 |
| 592 DISALLOW_COPY_AND_ASSIGN(Thread); | 596 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 593 }; | 597 }; |
| 594 | 598 |
| 595 } } // namespace v8::internal | 599 } } // namespace v8::internal |
| 596 | 600 |
| 597 #endif // V8_PLATFORM_H_ | 601 #endif // V8_PLATFORM_H_ |
| OLD | NEW |