Revision: 7440
Author:   [email protected]
Date:     Wed Mar 30 07:31:32 2011
Log:      Fix strict-aliasing violation in compilation of r7437.

BUG=
TEST=

Review URL: http://codereview.chromium.org/6765027
http://code.google.com/p/v8/source/detail?r=7440

Modified:
 /branches/bleeding_edge/src/ia32/codegen-ia32.cc
 /branches/bleeding_edge/src/platform-posix.cc
 /branches/bleeding_edge/src/platform-win32.cc
 /branches/bleeding_edge/src/x64/codegen-x64.cc

=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Wed Mar 30 07:04:26 2011 +++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Wed Mar 30 07:31:32 2011
@@ -10377,7 +10377,6 @@
   if (chunk == NULL) return &MemCopyWrapper;
   memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size);
   CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size);
-  MemoryBarrier();
   return FUNCTION_CAST<OS::MemCopyFunction>(chunk->GetStartAddress());
 }

=======================================
--- /branches/bleeding_edge/src/platform-posix.cc       Wed Mar 30 07:04:26 2011
+++ /branches/bleeding_edge/src/platform-posix.cc       Wed Mar 30 07:31:32 2011
@@ -217,8 +217,9 @@
     ScopedLock lock(memcopy_function_mutex);
     Isolate::EnsureDefaultIsolate();
     if (memcopy_function == NULL) {
-      Release_Store(reinterpret_cast<AtomicWord*>(&memcopy_function),
-                    reinterpret_cast<AtomicWord>(CreateMemCopyFunction()));
+      OS::MemCopyFunction temp = CreateMemCopyFunction();
+      MemoryBarrier();
+      memcopy_function = temp;
     }
   }
   (*memcopy_function)(dest, src, size);
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc       Wed Mar 30 07:04:26 2011
+++ /branches/bleeding_edge/src/platform-win32.cc       Wed Mar 30 07:31:32 2011
@@ -188,7 +188,9 @@
     ScopedLock lock(memcopy_function_mutex);
     Isolate::EnsureDefaultIsolate();
     if (memcopy_function == NULL) {
-      memcopy_function = CreateMemCopyFunction();
+      OS::MemCopyFunction temp = CreateMemCopyFunction();
+      MemoryBarrier();
+      memcopy_function = temp;
     }
   }
   (*memcopy_function)(dest, src, size);
@@ -210,8 +212,9 @@
     ScopedLock lock(modulo_function_mutex);
     Isolate::EnsureDefaultIsolate();
     if (modulo_function == NULL) {
-      Release_Store(reinterpret_cast<AtomicWord*>(&modulo_function),
-                    reinterpret_cast<AtomicWord>(CreateModuloFunction()));
+      ModuloFunction temp = CreateModuloFunction();
+      MemoryBarrier();
+      modulo_function = temp;
     }
   }
   return (*modulo_function)(x, y);
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc      Wed Mar 30 07:04:26 2011
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc      Wed Mar 30 07:31:32 2011
@@ -8824,9 +8824,6 @@

   CodeDesc desc;
   masm.GetCode(&desc);
-  // Make sure that the compiled code is visible to all threads before
-  // returning the pointer to it.
-  MemoryBarrier();
   // Call the function from C++ through this pointer.
   return FUNCTION_CAST<ModuloFunction>(buffer);
 }

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to