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

Unified Diff: src/heap/mark-compact.cc

Issue 1130833002: Respect double alignment in Mark-compact collector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months 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 | « src/heap/heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 85031caeef9781168c42870a52a324be8e3c0291..7e02afa3c9ebe65c982d8dffed41b3819e5574f5 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -1940,7 +1940,16 @@ int MarkCompactCollector::DiscoverAndEvacuateBlackObjectsOnPage(
continue;
}
- AllocationResult allocation = new_space->AllocateRaw(size);
+ AllocationResult allocation;
+#ifndef V8_HOST_ARCH_64_BIT
+ if (object->NeedsToEnsureDoubleAlignment()) {
+ allocation = new_space->AllocateRawDoubleAligned(size);
+ } else {
+ allocation = new_space->AllocateRaw(size);
+ }
+#else
+ allocation = new_space->AllocateRaw(size);
+#endif
if (allocation.IsRetry()) {
if (!new_space->AddFreshPage()) {
// Shouldn't happen. We are sweeping linearly, and to-space
@@ -1948,7 +1957,15 @@ int MarkCompactCollector::DiscoverAndEvacuateBlackObjectsOnPage(
// always room.
UNREACHABLE();
}
+#ifndef V8_HOST_ARCH_64_BIT
+ if (object->NeedsToEnsureDoubleAlignment()) {
+ allocation = new_space->AllocateRawDoubleAligned(size);
+ } else {
+ allocation = new_space->AllocateRaw(size);
+ }
+#else
allocation = new_space->AllocateRaw(size);
+#endif
DCHECK(!allocation.IsRetry());
}
Object* target = allocation.ToObjectChecked();
@@ -3077,7 +3094,16 @@ bool MarkCompactCollector::TryPromoteObject(HeapObject* object,
OldSpace* old_space = heap()->old_space();
HeapObject* target;
- AllocationResult allocation = old_space->AllocateRaw(object_size);
+ AllocationResult allocation;
+#ifndef V8_HOST_ARCH_64_BIT
+ if (object->NeedsToEnsureDoubleAlignment()) {
+ allocation = old_space->AllocateRawDoubleAligned(object_size);
+ } else {
+ allocation = old_space->AllocateRaw(object_size);
+ }
+#else
+ allocation = old_space->AllocateRaw(object_size);
+#endif
if (allocation.To(&target)) {
MigrateObject(target, object, object_size, old_space->identity());
heap()->IncrementPromotedObjectsSize(object_size);
« no previous file with comments | « src/heap/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698