Index: src/platform-posix.cc |
diff --git a/src/platform-posix.cc b/src/platform-posix.cc |
index 1b6c1c8352d73350c12ab0d0dcdff70dd40b727b..48898ed9aad0acdb4cc06ccba4b01c9818f26de4 100644 |
--- a/src/platform-posix.cc |
+++ b/src/platform-posix.cc |
@@ -322,25 +322,32 @@ 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; |
+ |
// 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(); |