Commit 4347d56a authored by bbudge's avatar bbudge Committed by Commit bot

Add SIMD 128 alignment support to Heap.

Adds SIMD 128 alignment sizes and masks.
Adds support in Heap for SIMD alignments and fills.
Reworks cctest so that each test independently aligns its allocation address, rather than depending on the previous tests ending state. Adds test cases for SIMD.

LOG=N
BUG=v8:4124

Review URL: https://codereview.chromium.org/1159453004

Cr-Commit-Position: refs/heads/master@{#28767}
parent 4f9df26b
......@@ -197,6 +197,8 @@ typedef int32_t uc32;
const int kOneByteSize = kCharSize;
const int kUC16Size = sizeof(uc16); // NOLINT
// 128 bit SIMD value size.
const int kSimd128Size = 16;
// Round up n to be a multiple of sz, where sz is a power of 2.
#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
......@@ -309,6 +311,10 @@ const intptr_t kPointerAlignmentMask = kPointerAlignment - 1;
const intptr_t kDoubleAlignment = 8;
const intptr_t kDoubleAlignmentMask = kDoubleAlignment - 1;
// Desired alignment for 128 bit SIMD values.
const intptr_t kSimd128Alignment = 16;
const intptr_t kSimd128AlignmentMask = kSimd128Alignment - 1;
// Desired alignment for generated code is 32 bytes (to improve cache line
// utilization).
const int kCodeAlignmentBits = 5;
......@@ -449,7 +455,12 @@ enum AllocationSpace {
const int kSpaceTagSize = 3;
const int kSpaceTagMask = (1 << kSpaceTagSize) - 1;
enum AllocationAlignment { kWordAligned, kDoubleAligned, kDoubleUnaligned };
enum AllocationAlignment {
kWordAligned,
kDoubleAligned,
kDoubleUnaligned,
kSimd128Unaligned
};
// A flag that indicates whether objects should be pretenured when
// allocated (allocated directly into the old generation) or not
......
......@@ -1995,6 +1995,8 @@ int Heap::GetMaximumFillToAlign(AllocationAlignment alignment) {
case kDoubleAligned:
case kDoubleUnaligned:
return kDoubleSize - kPointerSize;
case kSimd128Unaligned:
return kSimd128Size - kPointerSize;
default:
UNREACHABLE();
}
......@@ -2008,6 +2010,10 @@ int Heap::GetFillToAlign(Address address, AllocationAlignment alignment) {
return kPointerSize;
if (alignment == kDoubleUnaligned && (offset & kDoubleAlignmentMask) == 0)
return kDoubleSize - kPointerSize; // No fill if double is always aligned.
if (alignment == kSimd128Unaligned) {
return (kSimd128Size - (static_cast<int>(offset) + kPointerSize)) &
kSimd128AlignmentMask;
}
return 0;
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment