Use intrinsic for write barrier when applicable

x86 and x64 CPUs have a strong memory model where writes never pass
writes, and reads never pass reads. The memory model is strong enough
that it is automatically consistent with write-release and read-acquire
memory barriers. Therefore, all that is needed for WriteMemoryBarrier()
is an intrinsic to tell the compiler not to move code past the
barrier.

This change detects x86 and x64 CPUs on Windows and uses the
_WriteBarrier() intrinsic

Change-Id: I62263c0efb94cf1399b69f8de0dc225ae0a1325d
Reviewed-on: https://code-review.googlesource.com/3590
Reviewed-by: Paul Wankadia <junyer@google.com>
1 file changed