OS::MemMove/OS::MemCopy: Don't call through to generated code when size == 0...

OS::MemMove/OS::MemCopy: Don't call through to generated code when size == 0 to avoid prefetching invalid memory

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
parent e288a65e
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment