Chromium Code Reviews| Index: src/platform-posix.cc |
| diff --git a/src/platform-posix.cc b/src/platform-posix.cc |
| index 1b6c1c8352d73350c12ab0d0dcdff70dd40b727b..e88fcf881c1d7c08f6c09eddd128caee3afbf412 100644 |
| --- a/src/platform-posix.cc |
| +++ b/src/platform-posix.cc |
| @@ -322,25 +322,31 @@ int OS::VSNPrintF(Vector<char> str, |
| #if defined(V8_TARGET_ARCH_IA32) |
| -static OS::MemCopyFunction memcopy_function = NULL; |
| +static void MemMoveWrapper(void* dest, const void* src, size_t size) { |
| + memmove(dest, src, size); |
| +} |
| + |
| +// Initialize to library version so we can call this at any time during startup. |
| +static OS::MemMoveFunction memmove_function = &MemMoveWrapper; |
|
Michael Starzinger
2013/04/16 09:41:42
nit: Add an empty newline after "memmove_function"
Jakob Kummerow
2013/04/16 12:29:42
Done.
|
| // Defined in codegen-ia32.cc. |
| -OS::MemCopyFunction CreateMemCopyFunction(); |
| +OS::MemMoveFunction CreateMemMoveFunction(); |
| -// Copy memory area to disjoint memory area. |
| -void OS::MemCopy(void* dest, const void* src, size_t size) { |
| +// Copy memory area. No restrictions. |
| +void OS::MemMove(void* dest, const void* src, size_t size) { |
| // Note: here we rely on dependent reads being ordered. This is true |
| // on all architectures we currently support. |
| - (*memcopy_function)(dest, src, size); |
| -#ifdef DEBUG |
| - CHECK_EQ(0, memcmp(dest, src, size)); |
| -#endif |
| + (*memmove_function)(dest, src, size); |
| } |
| + |
| #endif // V8_TARGET_ARCH_IA32 |
| void POSIXPostSetUp() { |
| #if defined(V8_TARGET_ARCH_IA32) |
| - memcopy_function = CreateMemCopyFunction(); |
| + OS::MemMoveFunction generated_memmove = CreateMemMoveFunction(); |
| + if (generated_memmove != NULL) { |
| + memmove_function = generated_memmove; |
| + } |
| #endif |
| init_fast_sin_function(); |
| init_fast_cos_function(); |