Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Unified Diff: src/heap.cc

Issue 460043: Always 64-bit align floating point values in heap numbers.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698