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 14 matching lines...) Expand all Loading... |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 // Platform specific code for Win32. | 28 // Platform specific code for Win32. |
29 | 29 |
30 #define V8_WIN32_HEADERS_FULL | 30 #define V8_WIN32_HEADERS_FULL |
31 #include "win32-headers.h" | 31 #include "win32-headers.h" |
32 | 32 |
33 #include "v8.h" | 33 #include "v8.h" |
34 | 34 |
35 #include "codegen.h" | |
36 #include "platform.h" | 35 #include "platform.h" |
37 #include "vm-state-inl.h" | 36 #include "vm-state-inl.h" |
38 | 37 |
39 #ifdef _MSC_VER | 38 #ifdef _MSC_VER |
40 | 39 |
41 // Case-insensitive bounded string comparisons. Use stricmp() on Win32. Usually | 40 // Case-insensitive bounded string comparisons. Use stricmp() on Win32. Usually |
42 // defined in strings.h. | 41 // defined in strings.h. |
43 int strncasecmp(const char* s1, const char* s2, int n) { | 42 int strncasecmp(const char* s1, const char* s2, int n) { |
44 return _strnicmp(s1, s2, n); | 43 return _strnicmp(s1, s2, n); |
45 } | 44 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // dividend is a zero and divisor is nonzero finite => result equals dividend | 194 // dividend is a zero and divisor is nonzero finite => result equals dividend |
196 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && | 195 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && |
197 !(x == 0 && (y != 0 && isfinite(y)))) { | 196 !(x == 0 && (y != 0 && isfinite(y)))) { |
198 x = fmod(x, y); | 197 x = fmod(x, y); |
199 } | 198 } |
200 return x; | 199 return x; |
201 } | 200 } |
202 | 201 |
203 #endif // _WIN64 | 202 #endif // _WIN64 |
204 | 203 |
205 | |
206 static Mutex* transcendental_function_mutex = OS::CreateMutex(); | |
207 | |
208 #define TRANSCENDENTAL_FUNCTION(name, type) \ | |
209 static TranscendentalFunction fast_##name##_function = NULL; \ | |
210 double fast_##name(double x) { \ | |
211 if (fast_##name##_function == NULL) { \ | |
212 ScopedLock lock(transcendental_function_mutex); \ | |
213 TranscendentalFunction temp = \ | |
214 CreateTranscendentalFunction(type); \ | |
215 MemoryBarrier(); \ | |
216 fast_##name##_function = temp; \ | |
217 } \ | |
218 return (*fast_##name##_function)(x); \ | |
219 } | |
220 | |
221 TRANSCENDENTAL_FUNCTION(sin, TranscendentalCache::SIN) | |
222 TRANSCENDENTAL_FUNCTION(cos, TranscendentalCache::COS) | |
223 TRANSCENDENTAL_FUNCTION(tan, TranscendentalCache::TAN) | |
224 TRANSCENDENTAL_FUNCTION(log, TranscendentalCache::LOG) | |
225 | |
226 #undef TRANSCENDENTAL_FUNCTION | |
227 | |
228 | |
229 // ---------------------------------------------------------------------------- | 204 // ---------------------------------------------------------------------------- |
230 // The Time class represents time on win32. A timestamp is represented as | 205 // The Time class represents time on win32. A timestamp is represented as |
231 // a 64-bit integer in 100 nanoseconds since January 1, 1601 (UTC). JavaScript | 206 // a 64-bit integer in 100 nanoseconds since January 1, 1601 (UTC). JavaScript |
232 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC, | 207 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC, |
233 // January 1, 1970. | 208 // January 1, 1970. |
234 | 209 |
235 class Time { | 210 class Time { |
236 public: | 211 public: |
237 // Constructors. | 212 // Constructors. |
238 Time(); | 213 Time(); |
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 | 2069 |
2095 | 2070 |
2096 void Sampler::Stop() { | 2071 void Sampler::Stop() { |
2097 ASSERT(IsActive()); | 2072 ASSERT(IsActive()); |
2098 SamplerThread::RemoveActiveSampler(this); | 2073 SamplerThread::RemoveActiveSampler(this); |
2099 SetActive(false); | 2074 SetActive(false); |
2100 } | 2075 } |
2101 | 2076 |
2102 | 2077 |
2103 } } // namespace v8::internal | 2078 } } // namespace v8::internal |
OLD | NEW |