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

Unified Diff: src/heap/heap.cc

Issue 1138643005: Clean-up aligned allocation logic. (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 | « no previous file | src/heap/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 181bc2ca78232f440fdafeccf89e1f346fd0dbcf..f1b31663bf58f48351608047edcbc60efbc38bc2 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1036,9 +1036,9 @@ bool Heap::ReserveSpace(Reservation* reservations) {
DCHECK_LE(size, MemoryAllocator::PageAreaSize(
static_cast<AllocationSpace>(space)));
if (space == NEW_SPACE) {
- allocation = new_space()->AllocateRaw(size);
+ allocation = new_space()->AllocateRawUnaligned(size);
} else {
- allocation = paged_space(space)->AllocateRaw(size);
+ allocation = paged_space(space)->AllocateRawUnaligned(size);
}
HeapObject* free_space;
if (allocation.To(&free_space)) {
@@ -2146,17 +2146,10 @@ class ScavengingVisitor : public StaticVisitorBase {
Heap* heap = map->GetHeap();
DCHECK(heap->AllowedToBeMigrated(object, NEW_SPACE));
- AllocationResult allocation;
-#ifdef V8_HOST_ARCH_32_BIT
- if (alignment == kDoubleAlignment) {
- allocation =
- heap->new_space()->AllocateRawAligned(object_size, kDoubleAligned);
- } else {
- allocation = heap->new_space()->AllocateRaw(object_size);
- }
-#else
- allocation = heap->new_space()->AllocateRaw(object_size);
-#endif
+ AllocationAlignment align =
+ alignment == kDoubleAlignment ? kDoubleAligned : kWordAligned;
+ AllocationResult allocation =
+ heap->new_space()->AllocateRaw(object_size, align);
HeapObject* target = NULL; // Initialization to please compiler.
if (allocation.To(&target)) {
@@ -2183,17 +2176,10 @@ class ScavengingVisitor : public StaticVisitorBase {
HeapObject* object, int object_size) {
Heap* heap = map->GetHeap();
- AllocationResult allocation;
-#ifdef V8_HOST_ARCH_32_BIT
- if (alignment == kDoubleAlignment) {
- allocation =
- heap->old_space()->AllocateRawAligned(object_size, kDoubleAligned);
- } else {
- allocation = heap->old_space()->AllocateRaw(object_size);
- }
-#else
- allocation = heap->old_space()->AllocateRaw(object_size);
-#endif
+ AllocationAlignment align =
+ alignment == kDoubleAlignment ? kDoubleAligned : kWordAligned;
+ AllocationResult allocation =
+ heap->old_space()->AllocateRaw(object_size, align);
HeapObject* target = NULL; // Initialization to please compiler.
if (allocation.To(&target)) {
« no previous file with comments | « no previous file | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698