Title: [129907] trunk/Source/WebCore
Revision
129907
Author
kl...@webkit.org
Date
2012-09-28 09:14:32 -0700 (Fri, 28 Sep 2012)

Log Message

471kB below StyleSheetContents::parserAppendRule() on Membuster3.
<http://webkit.org/b/97916>

Reviewed by Anders Carlsson.

Shrink-to-fit the StyleSheetContents rule vectors at the end of CSSParser::parseSheet().
~100kB progression on Membuster3.

* css/StyleSheetContents.h:
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::shrinkToFit):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseSheet):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129906 => 129907)


--- trunk/Source/WebCore/ChangeLog	2012-09-28 16:09:17 UTC (rev 129906)
+++ trunk/Source/WebCore/ChangeLog	2012-09-28 16:14:32 UTC (rev 129907)
@@ -1,3 +1,19 @@
+2012-09-28  Andreas Kling  <kl...@webkit.org>
+
+        471kB below StyleSheetContents::parserAppendRule() on Membuster3.
+        <http://webkit.org/b/97916>
+
+        Reviewed by Anders Carlsson.
+
+        Shrink-to-fit the StyleSheetContents rule vectors at the end of CSSParser::parseSheet().
+        ~100kB progression on Membuster3.
+
+        * css/StyleSheetContents.h:
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::shrinkToFit):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseSheet):
+
 2012-09-28  Kent Tamura  <tk...@chromium.org>
 
         Clean up Localizer-related functions

Modified: trunk/Source/WebCore/css/CSSParser.cpp (129906 => 129907)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-09-28 16:09:17 UTC (rev 129906)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-09-28 16:14:32 UTC (rev 129907)
@@ -380,6 +380,7 @@
     m_lineNumber = startLineNumber;
     setupParser("", string, "");
     cssyyparse(this);
+    sheet->shrinkToFit();
     m_currentRuleDataStack.clear();
     m_ruleSourceDataResult = 0;
     m_rule = 0;

Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (129906 => 129907)


--- trunk/Source/WebCore/css/StyleSheetContents.cpp	2012-09-28 16:09:17 UTC (rev 129906)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp	2012-09-28 16:14:32 UTC (rev 129907)
@@ -485,6 +485,12 @@
     m_isInMemoryCache = false;
 }
 
+void StyleSheetContents::shrinkToFit()
+{
+    m_importRules.shrinkToFit();
+    m_childRules.shrinkToFit();
+}
+
 void StyleSheetContents::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);

Modified: trunk/Source/WebCore/css/StyleSheetContents.h (129906 => 129907)


--- trunk/Source/WebCore/css/StyleSheetContents.h	2012-09-28 16:09:17 UTC (rev 129906)
+++ trunk/Source/WebCore/css/StyleSheetContents.h	2012-09-28 16:14:32 UTC (rev 129907)
@@ -138,6 +138,8 @@
 
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
+    void shrinkToFit();
+
 private:
     StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext&);
     StyleSheetContents(const StyleSheetContents&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to