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

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

Issue 6765027: Fix strict-aliasing violation in compilation of r7437. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 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
« no previous file with comments | « src/platform-posix.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 static Mutex* memcopy_function_mutex = OS::CreateMutex(); 181 static Mutex* memcopy_function_mutex = OS::CreateMutex();
182 // Defined in codegen-ia32.cc. 182 // Defined in codegen-ia32.cc.
183 OS::MemCopyFunction CreateMemCopyFunction(); 183 OS::MemCopyFunction CreateMemCopyFunction();
184 184
185 // Copy memory area to disjoint memory area. 185 // Copy memory area to disjoint memory area.
186 void OS::MemCopy(void* dest, const void* src, size_t size) { 186 void OS::MemCopy(void* dest, const void* src, size_t size) {
187 if (memcopy_function == NULL) { 187 if (memcopy_function == NULL) {
188 ScopedLock lock(memcopy_function_mutex); 188 ScopedLock lock(memcopy_function_mutex);
189 Isolate::EnsureDefaultIsolate(); 189 Isolate::EnsureDefaultIsolate();
190 if (memcopy_function == NULL) { 190 if (memcopy_function == NULL) {
191 memcopy_function = CreateMemCopyFunction(); 191 OS::MemCopyFunction temp = CreateMemCopyFunction();
192 MemoryBarrier();
193 memcopy_function = temp;
192 } 194 }
193 } 195 }
194 (*memcopy_function)(dest, src, size); 196 (*memcopy_function)(dest, src, size);
195 #ifdef DEBUG 197 #ifdef DEBUG
196 CHECK_EQ(0, memcmp(dest, src, size)); 198 CHECK_EQ(0, memcmp(dest, src, size));
197 #endif 199 #endif
198 } 200 }
199 #endif // V8_TARGET_ARCH_IA32 201 #endif // V8_TARGET_ARCH_IA32
200 202
201 #ifdef _WIN64 203 #ifdef _WIN64
202 typedef double (*ModuloFunction)(double, double); 204 typedef double (*ModuloFunction)(double, double);
203 static ModuloFunction modulo_function = NULL; 205 static ModuloFunction modulo_function = NULL;
204 static Mutex* modulo_function_mutex = OS::CreateMutex(); 206 static Mutex* modulo_function_mutex = OS::CreateMutex();
205 // Defined in codegen-x64.cc. 207 // Defined in codegen-x64.cc.
206 ModuloFunction CreateModuloFunction(); 208 ModuloFunction CreateModuloFunction();
207 209
208 double modulo(double x, double y) { 210 double modulo(double x, double y) {
209 if (modulo_function == NULL) { 211 if (modulo_function == NULL) {
210 ScopedLock lock(modulo_function_mutex); 212 ScopedLock lock(modulo_function_mutex);
211 Isolate::EnsureDefaultIsolate(); 213 Isolate::EnsureDefaultIsolate();
212 if (modulo_function == NULL) { 214 if (modulo_function == NULL) {
213 Release_Store(reinterpret_cast<AtomicWord*>(&modulo_function), 215 ModuloFunction temp = CreateModuloFunction();
214 reinterpret_cast<AtomicWord>(CreateModuloFunction())); 216 MemoryBarrier();
217 modulo_function = temp;
215 } 218 }
216 } 219 }
217 return (*modulo_function)(x, y); 220 return (*modulo_function)(x, y);
218 } 221 }
219 #else // Win32 222 #else // Win32
220 223
221 double modulo(double x, double y) { 224 double modulo(double x, double y) {
222 // Workaround MS fmod bugs. ECMA-262 says: 225 // Workaround MS fmod bugs. ECMA-262 says:
223 // dividend is finite and divisor is an infinity => result equals dividend 226 // dividend is finite and divisor is an infinity => result equals dividend
224 // dividend is a zero and divisor is nonzero finite => result equals dividend 227 // dividend is a zero and divisor is nonzero finite => result equals dividend
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 2061
2059 void Sampler::Stop() { 2062 void Sampler::Stop() {
2060 ASSERT(IsActive()); 2063 ASSERT(IsActive());
2061 SamplerThread::RemoveActiveSampler(this); 2064 SamplerThread::RemoveActiveSampler(this);
2062 SetActive(false); 2065 SetActive(false);
2063 } 2066 }
2064 2067
2065 #endif // ENABLE_LOGGING_AND_PROFILING 2068 #endif // ENABLE_LOGGING_AND_PROFILING
2066 2069
2067 } } // namespace v8::internal 2070 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-posix.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698