| Index: src/heap/heap.cc
|
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
| index e5095c8336c9f7d75eb476af501ec55ecbf668d4..8a680a08cced3e0885a07c0c67fd5c7aece9e382 100644
|
| --- a/src/heap/heap.cc
|
| +++ b/src/heap/heap.cc
|
| @@ -1933,24 +1933,19 @@ STATIC_ASSERT((ConstantPoolArray::kExtendedFirstOffset &
|
| kDoubleAlignmentMask) == 0); // NOLINT
|
|
|
|
|
| -INLINE(static HeapObject* EnsureDoubleAligned(Heap* heap, HeapObject* object,
|
| - int size));
|
| -
|
| -static HeapObject* EnsureDoubleAligned(Heap* heap, HeapObject* object,
|
| - int size) {
|
| +HeapObject* Heap::EnsureDoubleAligned(HeapObject* object, int size) {
|
| if ((OffsetFrom(object->address()) & kDoubleAlignmentMask) != 0) {
|
| - heap->CreateFillerObjectAt(object->address(), kPointerSize);
|
| + CreateFillerObjectAt(object->address(), kPointerSize);
|
| return HeapObject::FromAddress(object->address() + kPointerSize);
|
| } else {
|
| - heap->CreateFillerObjectAt(object->address() + size - kPointerSize,
|
| - kPointerSize);
|
| + CreateFillerObjectAt(object->address() + size - kPointerSize, kPointerSize);
|
| return object;
|
| }
|
| }
|
|
|
|
|
| HeapObject* Heap::DoubleAlignForDeserialization(HeapObject* object, int size) {
|
| - return EnsureDoubleAligned(this, object, size);
|
| + return EnsureDoubleAligned(object, size);
|
| }
|
|
|
|
|
| @@ -2100,15 +2095,13 @@ class ScavengingVisitor : public StaticVisitorBase {
|
| HeapObject* object, int object_size) {
|
| Heap* heap = map->GetHeap();
|
|
|
| - int allocation_size = object_size;
|
| - if (alignment != kObjectAlignment) {
|
| - DCHECK(alignment == kDoubleAlignment);
|
| - allocation_size += kPointerSize;
|
| - }
|
| -
|
| DCHECK(heap->AllowedToBeMigrated(object, NEW_SPACE));
|
| - AllocationResult allocation =
|
| - heap->new_space()->AllocateRaw(allocation_size);
|
| + AllocationResult allocation;
|
| + if (alignment == kDoubleAlignment) {
|
| + allocation = heap->new_space()->AllocateRawDoubleAligned(object_size);
|
| + } else {
|
| + allocation = heap->new_space()->AllocateRaw(object_size);
|
| + }
|
|
|
| HeapObject* target = NULL; // Initialization to please compiler.
|
| if (allocation.To(&target)) {
|
| @@ -2118,9 +2111,6 @@ class ScavengingVisitor : public StaticVisitorBase {
|
| // object.
|
| heap->promotion_queue()->SetNewLimit(heap->new_space()->top());
|
|
|
| - if (alignment != kObjectAlignment) {
|
| - target = EnsureDoubleAligned(heap, target, allocation_size);
|
| - }
|
| MigrateObject(heap, object, target, object_size);
|
|
|
| // Update slot to new target.
|
| @@ -2138,20 +2128,15 @@ class ScavengingVisitor : public StaticVisitorBase {
|
| HeapObject* object, int object_size) {
|
| Heap* heap = map->GetHeap();
|
|
|
| - int allocation_size = object_size;
|
| - if (alignment != kObjectAlignment) {
|
| - DCHECK(alignment == kDoubleAlignment);
|
| - allocation_size += kPointerSize;
|
| - }
|
| -
|
| AllocationResult allocation;
|
| - allocation = heap->old_space()->AllocateRaw(allocation_size);
|
| + if (alignment == kDoubleAlignment) {
|
| + allocation = heap->old_space()->AllocateRawDoubleAligned(object_size);
|
| + } else {
|
| + allocation = heap->old_space()->AllocateRaw(object_size);
|
| + }
|
|
|
| HeapObject* target = NULL; // Initialization to please compiler.
|
| if (allocation.To(&target)) {
|
| - if (alignment != kObjectAlignment) {
|
| - target = EnsureDoubleAligned(heap, target, allocation_size);
|
| - }
|
| MigrateObject(heap, object, target, object_size);
|
|
|
| // Update slot to new target.
|
| @@ -3670,7 +3655,7 @@ AllocationResult Heap::AllocateFixedTypedArray(int length,
|
| if (!allocation.To(&object)) return allocation;
|
|
|
| if (array_type == kExternalFloat64Array) {
|
| - object = EnsureDoubleAligned(this, object, size);
|
| + object = EnsureDoubleAligned(object, size);
|
| }
|
|
|
| object->set_map(MapForFixedTypedArray(array_type));
|
| @@ -4401,7 +4386,7 @@ AllocationResult Heap::AllocateRawFixedDoubleArray(int length,
|
| if (!allocation.To(&object)) return allocation;
|
| }
|
|
|
| - return EnsureDoubleAligned(this, object, size);
|
| + return EnsureDoubleAligned(object, size);
|
| }
|
|
|
|
|
| @@ -4419,7 +4404,7 @@ AllocationResult Heap::AllocateConstantPoolArray(
|
| AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
|
| if (!allocation.To(&object)) return allocation;
|
| }
|
| - object = EnsureDoubleAligned(this, object, size);
|
| + object = EnsureDoubleAligned(object, size);
|
| object->set_map_no_write_barrier(constant_pool_array_map());
|
|
|
| ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object);
|
| @@ -4445,7 +4430,7 @@ AllocationResult Heap::AllocateExtendedConstantPoolArray(
|
| AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
|
| if (!allocation.To(&object)) return allocation;
|
| }
|
| - object = EnsureDoubleAligned(this, object, size);
|
| + object = EnsureDoubleAligned(object, size);
|
| object->set_map_no_write_barrier(constant_pool_array_map());
|
|
|
| ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object);
|
|
|