Author: [email protected]
Date: Thu Mar  5 04:45:47 2009
New Revision: 1428

Modified:
    branches/bleeding_edge/src/builtins.cc
    branches/bleeding_edge/src/objects.h
    branches/bleeding_edge/test/mjsunit/fuzz-natives.js

Log:
Arrays created with new Array(n) are not assumed to be sparse unless the  
given
size is truly huge.  A test had to be modified slightly so as not to be too  
slow.
Review URL: http://codereview.chromium.org/40163

Modified: branches/bleeding_edge/src/builtins.cc
==============================================================================
--- branches/bleeding_edge/src/builtins.cc      (original)
+++ branches/bleeding_edge/src/builtins.cc      Thu Mar  5 04:45:47 2009
@@ -155,7 +155,7 @@
      Object* obj = BUILTIN_ARG(1);
      if (obj->IsSmi()) {
        int len = Smi::cast(obj)->value();
-      if (len >= 0 && len < JSObject::kMaxFastElementsLength) {
+      if (len >= 0 && len < JSObject::kInitialMaxFastElementArray) {
          Object* obj = Heap::AllocateFixedArrayWithHoles(len);
          if (obj->IsFailure()) return obj;
          array->SetContent(FixedArray::cast(obj));

Modified: branches/bleeding_edge/src/objects.h
==============================================================================
--- branches/bleeding_edge/src/objects.h        (original)
+++ branches/bleeding_edge/src/objects.h        Thu Mar  5 04:45:47 2009
@@ -1433,6 +1433,7 @@

    static const uint32_t kMaxGap = 1024;
    static const int kMaxFastElementsLength = 5000;
+  static const int kInitialMaxFastElementArray = 100000;
    static const int kMaxFastProperties = 8;
    static const int kMaxInstanceSize = 255 * kPointerSize;
    // When extending the backing storage for property values, we increase

Modified: branches/bleeding_edge/test/mjsunit/fuzz-natives.js
==============================================================================
--- branches/bleeding_edge/test/mjsunit/fuzz-natives.js (original)
+++ branches/bleeding_edge/test/mjsunit/fuzz-natives.js Thu Mar  5 04:45:47  
2009
@@ -31,8 +31,8 @@
    var result = [ ];
    result.push(17);
    result.push(-31);
-  result.push(Number.MAX_VALUE);
-  result.push(new Array(5003));
+  result.push(new Array(100));
+  result.push(new Array(100003));
    result.push(Number.MIN_VALUE);
    result.push("whoops");
    result.push("x");

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to