[arrays] Increase max size of FixedDoubleArray by 2x on 64 bit

FixedArray max size is currently 1024 MB on 64 bit and 512 MB on 32 bit.
Update the max size of FixedDoubleArray to match. This doubles the max
size for arrays of doubles.

Bug: chromium:814599
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I3ac1b4caaf5b6428fe8a8c848fffdf84af8a9ae9
Reviewed-on: https://chromium-review.googlesource.com/1160235
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54892}
This commit is contained in:
Peter Marshall 2018-08-02 13:33:47 +02:00 committed by Commit Bot
parent a5efd5076b
commit 842569eb4b
2 changed files with 21 additions and 14 deletions

View File

@ -203,7 +203,7 @@ struct SmiTagging<4> {
V8_INLINE static internal::Object* IntToSmi(int value) {
return internal::IntToSmi<kSmiShiftSize>(value);
}
V8_INLINE static bool IsValidSmi(intptr_t value) {
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
// To be representable as an tagged small integer, the two
// most-significant bits of 'value' must be either 00 or 11 due to
// sign-extension. To check this we add 01 to the two
@ -233,7 +233,7 @@ struct SmiTagging<8> {
V8_INLINE static internal::Object* IntToSmi(int value) {
return internal::IntToSmi<kSmiShiftSize>(value);
}
V8_INLINE static bool IsValidSmi(intptr_t value) {
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
// To be representable as a long smi, the value must be a 32-bit integer.
return (value == static_cast<int32_t>(value));
}
@ -9528,7 +9528,7 @@ class Internals {
return PlatformSmiTagging::IntToSmi(value);
}
V8_INLINE static bool IsValidSmi(intptr_t value) {
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
return PlatformSmiTagging::IsValidSmi(value);
}

View File

@ -85,6 +85,15 @@ class FixedArrayBase : public HeapObject {
bool IsCowArray() const;
// Maximal allowed size, in bytes, of a single FixedArrayBase.
// Prevents overflowing size computations, as well as extreme memory
// consumption.
#ifdef V8_HOST_ARCH_32_BIT
static const int kMaxSize = 512 * MB;
#else
static const int kMaxSize = 1024 * MB;
#endif // V8_HOST_ARCH_32_BIT
// Layout description.
// Length is smi tagged when it is stored.
static const int kLengthOffset = HeapObject::kHeaderSize;
@ -160,13 +169,11 @@ class FixedArray : public FixedArrayBase {
inline Object** RawFieldOfElementAt(int index);
DECL_CAST(FixedArray)
// Maximal allowed size, in bytes, of a single FixedArray.
// Prevents overflowing size computations, as well as extreme memory
// consumption.
static const int kMaxSize = 128 * MB * kPointerSize;
// Maximally allowed length of a FixedArray.
static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize;
static_assert(Internals::IsValidSmi(kMaxLength),
"FixedArray maxLength not a Smi");
// Maximally allowed length for regular (non large object space) object.
STATIC_ASSERT(kMaxRegularHeapObjectSize < kMaxSize);
static const int kMaxRegularLength =
@ -239,12 +246,10 @@ class FixedDoubleArray : public FixedArrayBase {
DECL_CAST(FixedDoubleArray)
// Maximal allowed size, in bytes, of a single FixedDoubleArray.
// Prevents overflowing size computations, as well as extreme memory
// consumption.
static const int kMaxSize = 512 * MB;
// Maximally allowed length of a FixedArray.
static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize;
static_assert(Internals::IsValidSmi(kMaxLength),
"FixedDoubleArray maxLength not a Smi");
// Dispatched behavior.
DECL_PRINTER(FixedDoubleArray)
@ -300,6 +305,8 @@ class WeakFixedArray : public HeapObject {
static const int kMaxLength =
(FixedArray::kMaxSize - kHeaderSize) / kPointerSize;
static_assert(Internals::IsValidSmi(kMaxLength),
"WeakFixedArray maxLength not a Smi");
protected:
static int OffsetOfElementAt(int index) {
@ -581,10 +588,10 @@ class ByteArray : public FixedArrayBase {
// Layout description.
static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
// Maximal memory consumption for a single ByteArray.
static const int kMaxSize = 512 * MB;
// Maximal length of a single ByteArray.
static const int kMaxLength = kMaxSize - kHeaderSize;
static_assert(Internals::IsValidSmi(kMaxLength),
"ByteArray maxLength not a Smi");
class BodyDescriptor;
// No weak fields.