http://codereview.chromium.org/6777007/diff/1/src/platform-posix.cc File src/platform-posix.cc (right):
http://codereview.chromium.org/6777007/diff/1/src/platform-posix.cc#newcode215 src/platform-posix.cc:215: void OS::MemCopy(void* dest, const void* src, size_t size) { On 2011/03/30 10:17:19, Vitaly Repeshko wrote:
Why does this have to be in platform files? It'd be nice to avoid
repeating it. It depends on whether it is an inline function or not. Since the global statics need to be declared in a single compilation unit, and v8utils does not have a .cc file, and MemCopy seems like a platform-specific replacement for the OS memcpy function, this seemed like the right place for it. http://codereview.chromium.org/6777007/diff/1/src/platform-posix.cc#newcode220 src/platform-posix.cc:220: memcopy_function = CreateMemCopyFunction(); On 2011/03/30 10:17:19, Vitaly Repeshko wrote:
You need a memory barrier between function creation and storing it to
the global
pointer to make double-checked locking safe. Use MemoryBarrier or
Release_Store
from atomicops.
Done. http://codereview.chromium.org/6777007/diff/1/src/platform-posix.cc#newcode220 src/platform-posix.cc:220: memcopy_function = CreateMemCopyFunction(); We end the function CreateMemCopyFunction() with a CPU::FlushICache, but that does nothing, so I have also added a memory barrier there, just before returning the pointer. On 2011/03/30 10:17:19, Vitaly Repeshko wrote:
You need a memory barrier between function creation and storing it to
the global
pointer to make double-checked locking safe. Use MemoryBarrier or
Release_Store
from atomicops.
http://codereview.chromium.org/6777007/ -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
