Revision: 8704
Author:   [email protected]
Date:     Thu Jul 21 03:51:06 2011
Log:      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.

[email protected]
BUG=
TEST=

Review URL: http://codereview.chromium.org/7468024
http://code.google.com/p/v8/source/detail?r=8704

Modified:
 /branches/bleeding_edge/src/heap-inl.h

=======================================
--- /branches/bleeding_edge/src/heap-inl.h      Tue Jun  7 06:09:01 2011
+++ /branches/bleeding_edge/src/heap-inl.h      Thu Jul 21 03:51:06 2011
@@ -368,11 +368,7 @@

   int size_in_words = byte_size / kPointerSize;

-  if ((dst < src) || (dst >= (src + size_in_words))) {
-    ASSERT((dst >= (src + size_in_words)) ||
-           ((OffsetFrom(reinterpret_cast<Address>(src)) -
-             OffsetFrom(reinterpret_cast<Address>(dst))) >= kPointerSize));
-
+  if ((dst < src) || (dst >= (src + byte_size))) {
     Object** src_slot = reinterpret_cast<Object**>(src);
     Object** dst_slot = reinterpret_cast<Object**>(dst);
     Object** end_slot = src_slot + size_in_words;
@@ -390,8 +386,7 @@
                                                    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);
 }

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to