Index: src/heap.cc |
=================================================================== |
--- src/heap.cc (revision 3405) |
+++ src/heap.cc (working copy) |
@@ -773,6 +773,9 @@ |
// Copy the from-space object to its new location (given by the |
// forwarding address) and fix its map. |
HeapObject* target = source->map_word().ToForwardingAddress(); |
+ // We don't need to worry about alignment and HeapNumbers here because |
+ // a heap number is put in data space directly and not queued up for |
+ // copying and scanning for pointers here. |
CopyBlock(reinterpret_cast<Object**>(target->address()), |
reinterpret_cast<Object**>(source->address()), |
source->SizeFromMap(map)); |
@@ -936,11 +939,21 @@ |
HeapObject* Heap::MigrateObject(HeapObject* source, |
HeapObject* target, |
- int size) { |
- // Copy the content of source to target. |
- CopyBlock(reinterpret_cast<Object**>(target->address()), |
- reinterpret_cast<Object**>(source->address()), |
- size); |
+ int size, |
+ MapWord first_word) { |
+ if (kObjectAlignment == 4 && |
+ size == HeapNumber::kSize && |
+ ((reinterpret_cast<intptr_t>(source) & 7) != |
+ (reinterpret_cast<intptr_t>(target) & 7)) && |
+ first_word.ToMap() == Heap::heap_number_map()) { |
+ target->set_map_word(first_word); |
+ reinterpret_cast<HeapNumber*>(source)->CopyBodyTo(target); |
+ } else { |
+ // Copy the content of source to target. |
+ CopyBlock(reinterpret_cast<Object**>(target->address()), |
+ reinterpret_cast<Object**>(source->address()), |
+ size); |
+ } |
// Set the forwarding address. |
source->set_map_word(MapWord::FromForwardingAddress(target)); |
@@ -1039,7 +1052,7 @@ |
// and not revisited---we will never sweep that space for |
// pointers and the copied objects do not contain pointers to |
// new space objects. |
- *p = MigrateObject(object, target, object_size); |
+ *p = MigrateObject(object, target, object_size, first_word); |
#ifdef DEBUG |
VerifyNonPointerSpacePointersVisitor v; |
(*p)->Iterate(&v); |
@@ -1053,7 +1066,11 @@ |
Object* result = new_space_.AllocateRaw(object_size); |
// Failed allocation at this point is utterly unexpected. |
ASSERT(!result->IsFailure()); |
- *p = MigrateObject(object, HeapObject::cast(result), object_size); |
+ HeapObject* target = HeapObject::cast(result); |
+ *p = MigrateObject(object, |
+ HeapObject::cast(target), |
+ object_size, |
+ first_word); |
} |