Title: [152848] trunk/Source
Revision
152848
Author
[email protected]
Date
2013-07-18 09:50:38 -0700 (Thu, 18 Jul 2013)

Log Message

CodeBlock::m_argumentValueProfiles wastes a lot of memory.
<http://webkit.org/b/118852>
<rdar://problem/14481659>

Reviewed by Anders Carlsson.

Source/_javascript_Core:

Use Vector::resizeToFit() for CodeBlock::m_argumentValueProfiles. We don't need any padding
for growth, since we won't be appending to it anyway.

921 KB progression on <http://twitter.com/awesomekling>

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::setNumParameters):

Source/WTF:

Add Vector::resizeToFit(size), like resize() but without growth padding.

* wtf/Vector.h:
(WTF::::resizeToFit):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (152847 => 152848)


--- trunk/Source/_javascript_Core/ChangeLog	2013-07-18 15:44:12 UTC (rev 152847)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-07-18 16:50:38 UTC (rev 152848)
@@ -1,3 +1,19 @@
+2013-07-18  Andreas Kling  <[email protected]>
+
+        CodeBlock::m_argumentValueProfiles wastes a lot of memory.
+        <http://webkit.org/b/118852>
+        <rdar://problem/14481659>
+
+        Reviewed by Anders Carlsson.
+
+        Use Vector::resizeToFit() for CodeBlock::m_argumentValueProfiles. We don't need any padding
+        for growth, since we won't be appending to it anyway.
+
+        921 KB progression on <http://twitter.com/awesomekling>
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::setNumParameters):
+
 2013-07-17  Filip Pizlo  <[email protected]>
 
         Unreviewed, fix 32-bit after http://trac.webkit.org/changeset/152813

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (152847 => 152848)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-07-18 15:44:12 UTC (rev 152847)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-07-18 16:50:38 UTC (rev 152848)
@@ -2018,7 +2018,7 @@
     m_numParameters = newValue;
 
 #if ENABLE(VALUE_PROFILER)
-    m_argumentValueProfiles.resize(newValue);
+    m_argumentValueProfiles.resizeToFit(newValue);
 #endif
 }
 
@@ -2501,8 +2501,6 @@
     m_callLinkInfos.shrinkToFit();
 #endif
 #if ENABLE(VALUE_PROFILER)
-    if (shrinkMode == EarlyShrink)
-        m_argumentValueProfiles.shrinkToFit();
     m_rareCaseProfiles.shrinkToFit();
     m_specialFastCaseProfiles.shrinkToFit();
 #endif

Modified: trunk/Source/WTF/ChangeLog (152847 => 152848)


--- trunk/Source/WTF/ChangeLog	2013-07-18 15:44:12 UTC (rev 152847)
+++ trunk/Source/WTF/ChangeLog	2013-07-18 16:50:38 UTC (rev 152848)
@@ -1,3 +1,16 @@
+2013-07-18  Andreas Kling  <[email protected]>
+
+        CodeBlock::m_argumentValueProfiles wastes a lot of memory.
+        <http://webkit.org/b/118852>
+        <rdar://problem/14481659>
+
+        Reviewed by Anders Carlsson.
+
+        Add Vector::resizeToFit(size), like resize() but without growth padding.
+
+        * wtf/Vector.h:
+        (WTF::::resizeToFit):
+
 2013-07-17  Benjamin Poulain  <[email protected]>
 
         Add a thread safety assertion when creating an AtomicString from a StringImpl

Modified: trunk/Source/WTF/wtf/Vector.h (152847 => 152848)


--- trunk/Source/WTF/wtf/Vector.h	2013-07-18 15:44:12 UTC (rev 152847)
+++ trunk/Source/WTF/wtf/Vector.h	2013-07-18 16:50:38 UTC (rev 152848)
@@ -608,6 +608,7 @@
         void shrink(size_t size);
         void grow(size_t size);
         void resize(size_t size);
+        void resizeToFit(size_t size);
         void reserveCapacity(size_t newCapacity);
         bool tryReserveCapacity(size_t newCapacity);
         void reserveInitialCapacity(size_t initialCapacity);
@@ -897,6 +898,13 @@
     }
 
     template<typename T, size_t inlineCapacity, typename OverflowHandler>
+    void Vector<T, inlineCapacity, OverflowHandler>::resizeToFit(size_t size)
+    {
+        reserveCapacity(size);
+        resize(size);
+    }
+
+    template<typename T, size_t inlineCapacity, typename OverflowHandler>
     void Vector<T, inlineCapacity, OverflowHandler>::shrink(size_t size)
     {
         ASSERT(size <= m_size);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to