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

Unified Diff: src/heap/heap.cc

Issue 1128323003: Remove explicit double alignment from allocation helper functions. (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.h ('k') | 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 bfd1fb50958ee8288422606051700c4324438775..8ba6c59761988bb8bf47f21cb82383aa4bdab371 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -3666,21 +3666,14 @@ AllocationResult Heap::AllocateFixedTypedArray(int length,
ForFixedTypedArray(array_type, &element_size, &elements_kind);
int size = OBJECT_POINTER_ALIGN(length * element_size +
FixedTypedArrayBase::kDataOffset);
-#ifndef V8_HOST_ARCH_64_BIT
- if (array_type == kExternalFloat64Array) {
- size += kPointerSize;
- }
-#endif
AllocationSpace space = SelectSpace(size, pretenure);
HeapObject* object;
- AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
+ AllocationResult allocation = AllocateRaw(
+ size, space, OLD_SPACE,
+ array_type == kExternalFloat64Array ? kDoubleAligned : kWordAligned);
if (!allocation.To(&object)) return allocation;
- if (array_type == kExternalFloat64Array) {
- object = EnsureDoubleAligned(object, size);
- }
-
object->set_map(MapForFixedTypedArray(array_type));
FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object);
elements->set_length(length);
@@ -4395,21 +4388,20 @@ AllocationResult Heap::AllocateUninitializedFixedDoubleArray(
AllocationResult Heap::AllocateRawFixedDoubleArray(int length,
PretenureFlag pretenure) {
if (length < 0 || length > FixedDoubleArray::kMaxLength) {
- v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true);
+ v8::internal::Heap::FatalProcessOutOfMemory("invalid array length",
+ kDoubleAligned);
}
int size = FixedDoubleArray::SizeFor(length);
-#ifndef V8_HOST_ARCH_64_BIT
- size += kPointerSize;
-#endif
AllocationSpace space = SelectSpace(size, pretenure);
HeapObject* object;
{
- AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
+ AllocationResult allocation =
+ AllocateRaw(size, space, OLD_SPACE, kDoubleAligned);
if (!allocation.To(&object)) return allocation;
}
- return EnsureDoubleAligned(object, size);
+ return object;
}
@@ -4417,17 +4409,14 @@ AllocationResult Heap::AllocateConstantPoolArray(
const ConstantPoolArray::NumberOfEntries& small) {
CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType));
int size = ConstantPoolArray::SizeFor(small);
-#ifndef V8_HOST_ARCH_64_BIT
- size += kPointerSize;
-#endif
AllocationSpace space = SelectSpace(size, TENURED);
HeapObject* object;
{
- AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
+ AllocationResult allocation =
+ AllocateRaw(size, space, OLD_SPACE, kDoubleAligned);
if (!allocation.To(&object)) return allocation;
}
- object = EnsureDoubleAligned(object, size);
object->set_map_no_write_barrier(constant_pool_array_map());
ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object);
@@ -4443,17 +4432,14 @@ AllocationResult Heap::AllocateExtendedConstantPoolArray(
CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType));
CHECK(extended.are_in_range(0, kMaxInt));
int size = ConstantPoolArray::SizeForExtended(small, extended);
-#ifndef V8_HOST_ARCH_64_BIT
- size += kPointerSize;
-#endif
AllocationSpace space = SelectSpace(size, TENURED);
HeapObject* object;
{
- AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
+ AllocationResult allocation =
+ AllocateRaw(size, space, OLD_SPACE, kDoubleAligned);
if (!allocation.To(&object)) return allocation;
}
- object = EnsureDoubleAligned(object, size);
object->set_map_no_write_barrier(constant_pool_array_map());
ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object);
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698