Set maximum length of FixedArray in terms of elements instead an absolute number...
authorfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 22 Nov 2011 16:02:26 +0000 (16:02 +0000)
committerfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 22 Nov 2011 16:02:26 +0000 (16:02 +0000)
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

src/objects.h

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