Index: src/platform-win32.cc |
diff --git a/src/platform-win32.cc b/src/platform-win32.cc |
index 6f6fe9262abdbc06324de0d74cf44f5c325de0d5..9c7f5a9b4f521477117e56447f354ff20273fb5e 100644 |
--- a/src/platform-win32.cc |
+++ b/src/platform-win32.cc |
@@ -107,6 +107,29 @@ intptr_t OS::MaxVirtualMemory() { |
} |
+#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
+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::MemMoveFunction CreateMemMoveFunction(); |
+ |
+// Copy memory area to disjoint memory area. |
+void OS::MemMove(void* dest, const void* src, size_t size) { |
+ if (size == 0) return; |
+ // Note: here we rely on dependent reads being ordered. This is true |
+ // on all architectures we currently support. |
+ (*memmove_function)(dest, src, size); |
+} |
+ |
+#endif // V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
+ |
+ |
class TimezoneCache { |
public: |
TimezoneCache() : initialized_(false) { } |
@@ -429,6 +452,16 @@ char* Win32Time::LocalTimezone(TimezoneCache* cache) { |
} |
+void OS::PostSetUp() { |
+#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
+ OS::MemMoveFunction generated_memmove = CreateMemMoveFunction(); |
+ if (generated_memmove != NULL) { |
+ memmove_function = generated_memmove; |
+ } |
+#endif |
+} |
+ |
+ |
// Returns the accumulated user time for thread. |
int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { |
FILETIME dummy; |
@@ -880,7 +913,7 @@ OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size, |
if (file_mapping == NULL) return NULL; |
// Map a view of the file into memory |
void* memory = MapViewOfFile(file_mapping, FILE_MAP_ALL_ACCESS, 0, 0, size); |
- if (memory) MemMove(memory, initial, size); |
+ if (memory) OS::MemMove(memory, initial, size); |
return new Win32MemoryMappedFile(file, file_mapping, memory, size); |
} |