Reviewers: fschneider,

Description:
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=


Please review this at http://codereview.chromium.org/7468024/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/heap-inl.h


Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index 3f5554e2c2ea0049935701dc41ef6eca35e85c84..b0b4fbe2dcbd45f0a7a437e956efbf74004f0927 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<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 @@ 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);
 }


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

Reply via email to