OS::MemMove/OS::MemCopy: Don't call through to generated code when size == 0 to avoid...
authorjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 19 Apr 2013 16:38:19 +0000 (16:38 +0000)
committerjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 19 Apr 2013 16:38:19 +0000 (16:38 +0000)
BUG=chromium:233500

Review URL: https://codereview.chromium.org/14365011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14361 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/ia32/codegen-ia32.cc
src/platform-posix.cc
src/platform-win32.cc

index caf808b..7663c6a 100644 (file)
@@ -635,6 +635,8 @@ OS::MemMoveFunction CreateMemMoveFunction() {
   ASSERT(!RelocInfo::RequiresRelocation(desc));
   CPU::FlushICache(buffer, actual_size);
   OS::ProtectCode(buffer, actual_size);
+  // TODO(jkummerow): It would be nice to register this code creation event
+  // with the PROFILE / GDBJIT system.
   return FUNCTION_CAST<OS::MemMoveFunction>(buffer);
 }
 
index 26c71a6..f76ec44 100644 (file)
@@ -334,6 +334,7 @@ OS::MemMoveFunction CreateMemMoveFunction();
 
 // Copy memory area. No restrictions.
 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);
index 83831ec..6795844 100644 (file)
@@ -160,6 +160,7 @@ 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);