Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(992)

Unified Diff: src/platform-win32.cc

Issue 297303004: Revert 21502 - "Move OS::MemCopy and OS::MemMove out of platform to utils" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform-posix.cc ('k') | src/preparse-data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/platform-posix.cc ('k') | src/preparse-data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698