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

Unified Diff: src/heap/heap.cc

Issue 1159123002: Revert of Clean up aligned allocation code in preparation for SIMD alignments. (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/spaces.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 76cab33693938e23fd949ec7d1b8f82e10fe7175..09f4cc71278e39c57be57099f4c08aedcef34cbd 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1982,54 +1982,31 @@
#endif
-int Heap::GetMaximumFillToAlign(AllocationAlignment alignment) {
- switch (alignment) {
- case kWordAligned:
- return 0;
- case kDoubleAligned:
- case kDoubleUnaligned:
- return kDoubleSize - kPointerSize;
- default:
- UNREACHABLE();
- }
- return 0;
-}
-
-
-int Heap::GetFillToAlign(Address address, AllocationAlignment alignment) {
- intptr_t offset = OffsetFrom(address);
- if (alignment == kDoubleAligned && (offset & kDoubleAlignmentMask) != 0)
- return kPointerSize;
- if (alignment == kDoubleUnaligned && (offset & kDoubleAlignmentMask) == 0)
- return kDoubleSize - kPointerSize; // No fill if double is always aligned.
- return 0;
-}
-
-
-HeapObject* Heap::PrecedeWithFiller(HeapObject* object, int filler_size) {
- CreateFillerObjectAt(object->address(), filler_size);
- return HeapObject::FromAddress(object->address() + filler_size);
-}
-
-
-HeapObject* Heap::AlignWithFiller(HeapObject* object, int object_size,
- int allocation_size,
- AllocationAlignment alignment) {
- int filler_size = allocation_size - object_size;
- DCHECK(filler_size > 0);
- int pre_filler = GetFillToAlign(object->address(), alignment);
- if (pre_filler) {
- object = PrecedeWithFiller(object, pre_filler);
- filler_size -= pre_filler;
- }
- if (filler_size)
- CreateFillerObjectAt(object->address() + object_size, filler_size);
- return object;
+HeapObject* Heap::EnsureAligned(HeapObject* object, int size,
+ AllocationAlignment alignment) {
+ if (alignment == kDoubleAligned &&
+ (OffsetFrom(object->address()) & kDoubleAlignmentMask) != 0) {
+ CreateFillerObjectAt(object->address(), kPointerSize);
+ return HeapObject::FromAddress(object->address() + kPointerSize);
+ } else if (alignment == kDoubleUnaligned &&
+ (OffsetFrom(object->address()) & kDoubleAlignmentMask) == 0) {
+ CreateFillerObjectAt(object->address(), kPointerSize);
+ return HeapObject::FromAddress(object->address() + kPointerSize);
+ } else {
+ CreateFillerObjectAt(object->address() + size - kPointerSize, kPointerSize);
+ return object;
+ }
+}
+
+
+HeapObject* Heap::PrecedeWithFiller(HeapObject* object) {
+ CreateFillerObjectAt(object->address(), kPointerSize);
+ return HeapObject::FromAddress(object->address() + kPointerSize);
}
HeapObject* Heap::DoubleAlignForDeserialization(HeapObject* object, int size) {
- return AlignWithFiller(object, size, size + kPointerSize, kDoubleAligned);
+ return EnsureAligned(object, size, kDoubleAligned);
}
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698