@@ -1941,24 +1941,19 @@ STATIC_ASSERT((ConstantPoolArray::kExtendedFirstOffset &
19411941 kDoubleAlignmentMask ) == 0 ); // NOLINT
19421942
19431943
1944- INLINE (static HeapObject* EnsureDoubleAligned (Heap* heap, HeapObject* object,
1945- int size));
1946-
1947- static HeapObject* EnsureDoubleAligned (Heap* heap, HeapObject* object,
1948- int size) {
1944+ HeapObject* Heap::EnsureDoubleAligned (HeapObject* object, int size) {
19491945 if ((OffsetFrom (object->address ()) & kDoubleAlignmentMask ) != 0 ) {
1950- heap-> CreateFillerObjectAt (object->address (), kPointerSize );
1946+ CreateFillerObjectAt (object->address (), kPointerSize );
19511947 return HeapObject::FromAddress (object->address () + kPointerSize );
19521948 } else {
1953- heap->CreateFillerObjectAt (object->address () + size - kPointerSize ,
1954- kPointerSize );
1949+ CreateFillerObjectAt (object->address () + size - kPointerSize , kPointerSize );
19551950 return object;
19561951 }
19571952}
19581953
19591954
19601955HeapObject* Heap::DoubleAlignForDeserialization (HeapObject* object, int size) {
1961- return EnsureDoubleAligned (this , object, size);
1956+ return EnsureDoubleAligned (object, size);
19621957}
19631958
19641959
@@ -2108,15 +2103,13 @@ class ScavengingVisitor : public StaticVisitorBase {
21082103 HeapObject* object, int object_size) {
21092104 Heap* heap = map->GetHeap ();
21102105
2111- int allocation_size = object_size;
2112- if (alignment != kObjectAlignment ) {
2113- DCHECK (alignment == kDoubleAlignment );
2114- allocation_size += kPointerSize ;
2115- }
2116-
21172106 DCHECK (heap->AllowedToBeMigrated (object, NEW_SPACE ));
2118- AllocationResult allocation =
2119- heap->new_space ()->AllocateRaw (allocation_size);
2107+ AllocationResult allocation;
2108+ if (alignment == kDoubleAlignment ) {
2109+ allocation = heap->new_space ()->AllocateRawDoubleAligned (object_size);
2110+ } else {
2111+ allocation = heap->new_space ()->AllocateRaw (object_size);
2112+ }
21202113
21212114 HeapObject* target = NULL ; // Initialization to please compiler.
21222115 if (allocation.To (&target)) {
@@ -2126,9 +2119,6 @@ class ScavengingVisitor : public StaticVisitorBase {
21262119 // object.
21272120 heap->promotion_queue ()->SetNewLimit (heap->new_space ()->top ());
21282121
2129- if (alignment != kObjectAlignment ) {
2130- target = EnsureDoubleAligned (heap, target, allocation_size);
2131- }
21322122 MigrateObject (heap, object, target, object_size);
21332123
21342124 // Update slot to new target.
@@ -2146,20 +2136,15 @@ class ScavengingVisitor : public StaticVisitorBase {
21462136 HeapObject* object, int object_size) {
21472137 Heap* heap = map->GetHeap ();
21482138
2149- int allocation_size = object_size;
2150- if (alignment != kObjectAlignment ) {
2151- DCHECK (alignment == kDoubleAlignment );
2152- allocation_size += kPointerSize ;
2153- }
2154-
21552139 AllocationResult allocation;
2156- allocation = heap->old_space ()->AllocateRaw (allocation_size);
2140+ if (alignment == kDoubleAlignment ) {
2141+ allocation = heap->old_space ()->AllocateRawDoubleAligned (object_size);
2142+ } else {
2143+ allocation = heap->old_space ()->AllocateRaw (object_size);
2144+ }
21572145
21582146 HeapObject* target = NULL ; // Initialization to please compiler.
21592147 if (allocation.To (&target)) {
2160- if (alignment != kObjectAlignment ) {
2161- target = EnsureDoubleAligned (heap, target, allocation_size);
2162- }
21632148 MigrateObject (heap, object, target, object_size);
21642149
21652150 // Update slot to new target.
@@ -3678,7 +3663,7 @@ AllocationResult Heap::AllocateFixedTypedArray(int length,
36783663 if (!allocation.To (&object)) return allocation;
36793664
36803665 if (array_type == kExternalFloat64Array ) {
3681- object = EnsureDoubleAligned (this , object, size);
3666+ object = EnsureDoubleAligned (object, size);
36823667 }
36833668
36843669 object->set_map (MapForFixedTypedArray (array_type));
@@ -4409,7 +4394,7 @@ AllocationResult Heap::AllocateRawFixedDoubleArray(int length,
44094394 if (!allocation.To (&object)) return allocation;
44104395 }
44114396
4412- return EnsureDoubleAligned (this , object, size);
4397+ return EnsureDoubleAligned (object, size);
44134398}
44144399
44154400
@@ -4427,7 +4412,7 @@ AllocationResult Heap::AllocateConstantPoolArray(
44274412 AllocationResult allocation = AllocateRaw (size, space, OLD_SPACE );
44284413 if (!allocation.To (&object)) return allocation;
44294414 }
4430- object = EnsureDoubleAligned (this , object, size);
4415+ object = EnsureDoubleAligned (object, size);
44314416 object->set_map_no_write_barrier (constant_pool_array_map ());
44324417
44334418 ConstantPoolArray* constant_pool = ConstantPoolArray::cast (object);
@@ -4453,7 +4438,7 @@ AllocationResult Heap::AllocateExtendedConstantPoolArray(
44534438 AllocationResult allocation = AllocateRaw (size, space, OLD_SPACE );
44544439 if (!allocation.To (&object)) return allocation;
44554440 }
4456- object = EnsureDoubleAligned (this , object, size);
4441+ object = EnsureDoubleAligned (object, size);
44574442 object->set_map_no_write_barrier (constant_pool_array_map ());
44584443
44594444 ConstantPoolArray* constant_pool = ConstantPoolArray::cast (object);
0 commit comments