OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 216 } |
217 | 217 |
218 | 218 |
219 namespace v8 { | 219 namespace v8 { |
220 namespace internal { | 220 namespace internal { |
221 | 221 |
222 double ceiling(double x) { | 222 double ceiling(double x) { |
223 return ceil(x); | 223 return ceil(x); |
224 } | 224 } |
225 | 225 |
| 226 #ifdef _WIN64 |
| 227 typedef double (*ModuloFunction)(double, double); |
| 228 |
| 229 // Defined in codegen-x64.cc. |
| 230 ModuloFunction CreateModuloFunction(); |
| 231 |
| 232 double modulo(double x, double y) { |
| 233 static ModuloFunction function = CreateModuloFunction(); |
| 234 return function(x, y); |
| 235 } |
| 236 #else // Win32 |
| 237 |
| 238 double modulo(double x, double y) { |
| 239 // Workaround MS fmod bugs. ECMA-262 says: |
| 240 // dividend is finite and divisor is an infinity => result equals dividend |
| 241 // dividend is a zero and divisor is nonzero finite => result equals dividend |
| 242 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && |
| 243 !(x == 0 && (y != 0 && isfinite(y)))) { |
| 244 x = fmod(x, y); |
| 245 } |
| 246 return x; |
| 247 } |
| 248 |
| 249 #endif // _WIN64 |
| 250 |
226 // ---------------------------------------------------------------------------- | 251 // ---------------------------------------------------------------------------- |
227 // The Time class represents time on win32. A timestamp is represented as | 252 // The Time class represents time on win32. A timestamp is represented as |
228 // a 64-bit integer in 100 nano-seconds since January 1, 1601 (UTC). JavaScript | 253 // a 64-bit integer in 100 nano-seconds since January 1, 1601 (UTC). JavaScript |
229 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC, | 254 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC, |
230 // January 1, 1970. | 255 // January 1, 1970. |
231 | 256 |
232 class Time { | 257 class Time { |
233 public: | 258 public: |
234 // Constructors. | 259 // Constructors. |
235 Time(); | 260 Time(); |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 | 1905 |
1881 // Release the thread handles | 1906 // Release the thread handles |
1882 CloseHandle(data_->sampler_thread_); | 1907 CloseHandle(data_->sampler_thread_); |
1883 CloseHandle(data_->profiled_thread_); | 1908 CloseHandle(data_->profiled_thread_); |
1884 } | 1909 } |
1885 | 1910 |
1886 | 1911 |
1887 #endif // ENABLE_LOGGING_AND_PROFILING | 1912 #endif // ENABLE_LOGGING_AND_PROFILING |
1888 | 1913 |
1889 } } // namespace v8::internal | 1914 } } // namespace v8::internal |
OLD | NEW |