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
This commit is contained in:
ager@chromium.org 2011-07-21 10:51:06 +00:00
parent 651e1b2460
commit 7a0adba963

View File

@ -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);
}