From 7a0adba963977437f7c7a09aeaa35918e76d2529 Mon Sep 17 00:00:00 2001 From: "ager@chromium.org" Date: Thu, 21 Jul 2011 10:51:06 +0000 Subject: [PATCH] Fix overlap check in MoveBlock and fix assertion. The old code was adding a size in words to a byte*. Should use size in bytes. Also, the assertions were doing signed comparisons on pointers instead of unsigned. Fixing the assertions makes one of the assertions identical to the condition just before it. R=fschneider@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/7468024 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8704 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/heap-inl.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/heap-inl.h b/src/heap-inl.h index 3f5554e2c2..b0b4fbe2dc 100644 --- a/src/heap-inl.h +++ b/src/heap-inl.h @@ -368,11 +368,7 @@ void Heap::MoveBlock(Address dst, Address src, int byte_size) { int size_in_words = byte_size / kPointerSize; - if ((dst < src) || (dst >= (src + size_in_words))) { - ASSERT((dst >= (src + size_in_words)) || - ((OffsetFrom(reinterpret_cast
(src)) - - OffsetFrom(reinterpret_cast
(dst))) >= kPointerSize)); - + if ((dst < src) || (dst >= (src + byte_size))) { Object** src_slot = reinterpret_cast(src); Object** dst_slot = reinterpret_cast(dst); Object** end_slot = src_slot + size_in_words; @@ -390,8 +386,7 @@ void Heap::MoveBlockToOldSpaceAndUpdateRegionMarks(Address dst, Address src, int byte_size) { ASSERT(IsAligned(byte_size, kPointerSize)); - ASSERT((dst >= (src + byte_size)) || - ((OffsetFrom(src) - OffsetFrom(dst)) >= kPointerSize)); + ASSERT((dst < src) || (dst >= (src + byte_size))); CopyBlockToOldSpaceAndUpdateRegionMarks(dst, src, byte_size); }