Commit df071455 authored by whesse@chromium.org's avatar whesse@chromium.org

Fix strict-aliasing violation in compilation of r7437.

BUG=
TEST=

Review URL: http://codereview.chromium.org/6765027

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7440 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a0519556
......@@ -10377,7 +10377,6 @@ OS::MemCopyFunction CreateMemCopyFunction() {
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());
}
......
......@@ -217,8 +217,9 @@ void OS::MemCopy(void* dest, const void* src, size_t size) {
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);
......
......@@ -188,7 +188,9 @@ void OS::MemCopy(void* dest, const void* src, size_t size) {
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 @@ double modulo(double x, double y) {
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);
......
......@@ -8824,9 +8824,6 @@ ModuloFunction CreateModuloFunction() {
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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment