Set maximum length of FixedArray in terms of elements instead an absolute number of bytes.

This sets the limit to 128M elements on all platforms. Before allocating a large array may
cause an OutOfMemory on x64 whereas it would not on ia32.

Also remove an unused constant from the FreeSpace class.

BUG=103103
Review URL: http://codereview.chromium.org/8637015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10044 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
fschneider@chromium.org 2011-11-22 16:02:26 +00:00
parent be1a94b626
commit 23e948b8a7

View File

@ -2098,7 +2098,7 @@ class FixedArray: public FixedArrayBase {
// Maximal allowed size, in bytes, of a single FixedArray. // Maximal allowed size, in bytes, of a single FixedArray.
// Prevents overflowing size computations, as well as extreme memory // Prevents overflowing size computations, as well as extreme memory
// consumption. // consumption.
static const int kMaxSize = 512 * MB; static const int kMaxSize = 128 * MB * kPointerSize;
// Maximally allowed length of a FixedArray. // Maximally allowed length of a FixedArray.
static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize;
@ -3339,9 +3339,6 @@ class FreeSpace: public HeapObject {
static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
// Maximal size of a single FreeSpace.
static const int kMaxSize = 512 * MB;
private: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace); DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace);
}; };