Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/platform-win32.cc

Issue 9583037: Reland r10908 (Ensure consistent result of transcendental function0.) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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"
35 #include "platform.h" 36 #include "platform.h"
36 #include "vm-state-inl.h" 37 #include "vm-state-inl.h"
37 38
38 #ifdef _MSC_VER 39 #ifdef _MSC_VER
39 40
40 // Case-insensitive bounded string comparisons. Use stricmp() on Win32. Usually 41 // Case-insensitive bounded string comparisons. Use stricmp() on Win32. Usually
41 // defined in strings.h. 42 // defined in strings.h.
42 int strncasecmp(const char* s1, const char* s2, int n) { 43 int strncasecmp(const char* s1, const char* s2, int n) {
43 return _strnicmp(s1, s2, n); 44 return _strnicmp(s1, s2, n);
44 } 45 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // dividend is a zero and divisor is nonzero finite => result equals dividend 195 // dividend is a zero and divisor is nonzero finite => result equals dividend
195 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && 196 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) &&
196 !(x == 0 && (y != 0 && isfinite(y)))) { 197 !(x == 0 && (y != 0 && isfinite(y)))) {
197 x = fmod(x, y); 198 x = fmod(x, y);
198 } 199 }
199 return x; 200 return x;
200 } 201 }
201 202
202 #endif // _WIN64 203 #endif // _WIN64
203 204
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
204 // ---------------------------------------------------------------------------- 229 // ----------------------------------------------------------------------------
205 // The Time class represents time on win32. A timestamp is represented as 230 // The Time class represents time on win32. A timestamp is represented as
206 // a 64-bit integer in 100 nanoseconds since January 1, 1601 (UTC). JavaScript 231 // a 64-bit integer in 100 nanoseconds since January 1, 1601 (UTC). JavaScript
207 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC, 232 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC,
208 // January 1, 1970. 233 // January 1, 1970.
209 234
210 class Time { 235 class Time {
211 public: 236 public:
212 // Constructors. 237 // Constructors.
213 Time(); 238 Time();
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 2093
2069 2094
2070 void Sampler::Stop() { 2095 void Sampler::Stop() {
2071 ASSERT(IsActive()); 2096 ASSERT(IsActive());
2072 SamplerThread::RemoveActiveSampler(this); 2097 SamplerThread::RemoveActiveSampler(this);
2073 SetActive(false); 2098 SetActive(false);
2074 } 2099 }
2075 2100
2076 2101
2077 } } // namespace v8::internal 2102 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698