[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

msaboff at apple.com msaboff at apple.com
Wed Dec 22 13:50:17 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ed1d7c7601ef5bd42b8d2bfb00d38d5e41cfbf55
Author: msaboff at apple.com <msaboff at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 28 01:52:44 2010 +0000

    2010-09-27  Michael Saboff  <msaboff at apple.com>
    
            Reviewed by Geoffrey Garen.
    
            Changed the initialization of JSArray objects to have space for
            3 elements for the constructor that takes a ArgList argument.
            This improves v8-deltablue performance by about 2.8% by reducing
            the number of realloc() calls.
            https://bugs.webkit.org/show_bug.cgi?id=46664
    
            * runtime/JSArray.cpp:
            (JSC::JSArray::JSArray):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68469 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 4c2e226..0794c35 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-27  Michael Saboff  <msaboff at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        Changed the initialization of JSArray objects to have space for 
+        3 elements for the constructor that takes a ArgList argument.
+        This improves v8-deltablue performance by about 2.8% by reducing 
+        the number of realloc() calls.
+        https://bugs.webkit.org/show_bug.cgi?id=46664
+
+        * runtime/JSArray.cpp:
+        (JSC::JSArray::JSArray):
+
 2010-09-27  Gavin Barraclough  <barraclough at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/JavaScriptCore/runtime/JSArray.cpp b/JavaScriptCore/runtime/JSArray.cpp
index 340cb75..dae807f 100644
--- a/JavaScriptCore/runtime/JSArray.cpp
+++ b/JavaScriptCore/runtime/JSArray.cpp
@@ -202,12 +202,20 @@ JSArray::JSArray(NonNullPassRefPtr<Structure> structure, const ArgList& list)
     : JSObject(structure)
 {
     unsigned initialCapacity = list.size();
-
-    m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity)));
+    unsigned initialStorage;
+    
+    // If the ArgList is empty, allocate space for 3 entries.  This value empirically
+    // works well for benchmarks.
+    if (!initialCapacity)
+        initialStorage = 3;
+    else
+        initialStorage = initialCapacity;
+    
+    m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialStorage)));
     m_storage->m_allocBase = m_storage;
     m_indexBias = 0;
     m_storage->m_length = initialCapacity;
-    m_vectorLength = initialCapacity;
+    m_vectorLength = initialStorage;
     m_storage->m_numValuesInVector = initialCapacity;
     m_storage->m_sparseValueMap = 0;
     m_storage->subclassData = 0;
@@ -221,10 +229,12 @@ JSArray::JSArray(NonNullPassRefPtr<Structure> structure, const ArgList& list)
     ArgList::const_iterator end = list.end();
     for (ArgList::const_iterator it = list.begin(); it != end; ++it, ++i)
         vector[i] = *it;
+    for (; i < initialStorage; i++)
+        vector[i] = JSValue();
 
     checkConsistency();
 
-    Heap::heap(this)->reportExtraMemoryCost(storageSize(initialCapacity));
+    Heap::heap(this)->reportExtraMemoryCost(storageSize(initialStorage));
 }
 
 JSArray::~JSArray()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list