Commit 7a0adba9 authored by ager@chromium.org's avatar ager@chromium.org

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
parent 651e1b24
...@@ -368,11 +368,7 @@ void Heap::MoveBlock(Address dst, Address src, int byte_size) { ...@@ -368,11 +368,7 @@ void Heap::MoveBlock(Address dst, Address src, int byte_size) {
int size_in_words = byte_size / kPointerSize; int size_in_words = byte_size / kPointerSize;
if ((dst < src) || (dst >= (src + size_in_words))) { if ((dst < src) || (dst >= (src + byte_size))) {
ASSERT((dst >= (src + size_in_words)) ||
((OffsetFrom(reinterpret_cast<Address>(src)) -
OffsetFrom(reinterpret_cast<Address>(dst))) >= kPointerSize));
Object** src_slot = reinterpret_cast<Object**>(src); Object** src_slot = reinterpret_cast<Object**>(src);
Object** dst_slot = reinterpret_cast<Object**>(dst); Object** dst_slot = reinterpret_cast<Object**>(dst);
Object** end_slot = src_slot + size_in_words; Object** end_slot = src_slot + size_in_words;
...@@ -390,8 +386,7 @@ void Heap::MoveBlockToOldSpaceAndUpdateRegionMarks(Address dst, ...@@ -390,8 +386,7 @@ void Heap::MoveBlockToOldSpaceAndUpdateRegionMarks(Address dst,
Address src, Address src,
int byte_size) { int byte_size) {
ASSERT(IsAligned(byte_size, kPointerSize)); ASSERT(IsAligned(byte_size, kPointerSize));
ASSERT((dst >= (src + byte_size)) || ASSERT((dst < src) || (dst >= (src + byte_size)));
((OffsetFrom(src) - OffsetFrom(dst)) >= kPointerSize));
CopyBlockToOldSpaceAndUpdateRegionMarks(dst, src, byte_size); CopyBlockToOldSpaceAndUpdateRegionMarks(dst, src, byte_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