Title: [201559] trunk/Source/WebCore
- Revision
- 201559
- Author
- [email protected]
- Date
- 2016-06-01 11:14:25 -0700 (Wed, 01 Jun 2016)
Log Message
Use inline capacity for StylePropertyShorthand Vectors.
<https://webkit.org/b/158260>
Reviewed by Antti Koivisto.
Vector<StylePropertyShorthand> was a huge source of heap allocations,
just over 0.5% of all fastMalloc() bytes on PLUM. Giving it an inline capacity
of 4 turns all of it into stack allocations.
* css/CSSParser.cpp:
(WebCore::CSSParser::addProperty):
* css/CSSProperty.cpp:
(WebCore::StylePropertyMetadata::shorthandID):
* css/StylePropertyShorthand.cpp:
(WebCore::indexOfShorthandForLonghand):
* css/StylePropertyShorthand.h:
* css/makeprop.pl:
(constructShorthandsVector):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (201558 => 201559)
--- trunk/Source/WebCore/ChangeLog 2016-06-01 17:38:04 UTC (rev 201558)
+++ trunk/Source/WebCore/ChangeLog 2016-06-01 18:14:25 UTC (rev 201559)
@@ -1,3 +1,24 @@
+2016-06-01 Andreas Kling <[email protected]>
+
+ Use inline capacity for StylePropertyShorthand Vectors.
+ <https://webkit.org/b/158260>
+
+ Reviewed by Antti Koivisto.
+
+ Vector<StylePropertyShorthand> was a huge source of heap allocations,
+ just over 0.5% of all fastMalloc() bytes on PLUM. Giving it an inline capacity
+ of 4 turns all of it into stack allocations.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::addProperty):
+ * css/CSSProperty.cpp:
+ (WebCore::StylePropertyMetadata::shorthandID):
+ * css/StylePropertyShorthand.cpp:
+ (WebCore::indexOfShorthandForLonghand):
+ * css/StylePropertyShorthand.h:
+ * css/makeprop.pl:
+ (constructShorthandsVector):
+
2016-06-01 Nael Ouedraogo <[email protected]>
POST request on a blob resource should return a "network error" instead of HTTP 500 response
Modified: trunk/Source/WebCore/css/CSSParser.cpp (201558 => 201559)
--- trunk/Source/WebCore/css/CSSParser.cpp 2016-06-01 17:38:04 UTC (rev 201558)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2016-06-01 18:14:25 UTC (rev 201559)
@@ -1609,7 +1609,7 @@
return;
}
- Vector<StylePropertyShorthand> shorthands = matchingShorthandsForLonghand(propId);
+ auto shorthands = matchingShorthandsForLonghand(propId);
if (shorthands.size() == 1)
m_parsedProperties.append(CSSProperty(propId, WTFMove(value), important, true, CSSPropertyInvalid, m_implicitShorthand || implicit));
else
Modified: trunk/Source/WebCore/css/CSSProperty.cpp (201558 => 201559)
--- trunk/Source/WebCore/css/CSSProperty.cpp 2016-06-01 17:38:04 UTC (rev 201558)
+++ trunk/Source/WebCore/css/CSSProperty.cpp 2016-06-01 18:14:25 UTC (rev 201559)
@@ -43,7 +43,7 @@
if (!m_isSetFromShorthand)
return CSSPropertyInvalid;
- Vector<StylePropertyShorthand> shorthands = matchingShorthandsForLonghand(static_cast<CSSPropertyID>(m_propertyID));
+ auto shorthands = matchingShorthandsForLonghand(static_cast<CSSPropertyID>(m_propertyID));
ASSERT(shorthands.size() && m_indexInShorthandsVector >= 0 && m_indexInShorthandsVector < shorthands.size());
return shorthands[m_indexInShorthandsVector].id();
}
Modified: trunk/Source/WebCore/css/StylePropertyShorthand.cpp (201558 => 201559)
--- trunk/Source/WebCore/css/StylePropertyShorthand.cpp 2016-06-01 17:38:04 UTC (rev 201558)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.cpp 2016-06-01 18:14:25 UTC (rev 201559)
@@ -68,7 +68,7 @@
return shorthandForProperty(id).length();
}
-unsigned indexOfShorthandForLonghand(CSSPropertyID shorthandID, const Vector<StylePropertyShorthand>& shorthands)
+unsigned indexOfShorthandForLonghand(CSSPropertyID shorthandID, const StylePropertyShorthandVector& shorthands)
{
for (unsigned i = 0, size = shorthands.size(); i < size; ++i) {
if (shorthands[i].id() == shorthandID)
Modified: trunk/Source/WebCore/css/StylePropertyShorthand.h (201558 => 201559)
--- trunk/Source/WebCore/css/StylePropertyShorthand.h 2016-06-01 17:38:04 UTC (rev 201558)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.h 2016-06-01 18:14:25 UTC (rev 201559)
@@ -61,9 +61,10 @@
// Return the list of shorthands for a given longhand.
// The implementation is generated in StylePropertyShorthandFunctions.cpp.
-Vector<StylePropertyShorthand> matchingShorthandsForLonghand(CSSPropertyID);
+using StylePropertyShorthandVector = Vector<StylePropertyShorthand, 4>;
+StylePropertyShorthandVector matchingShorthandsForLonghand(CSSPropertyID);
-unsigned indexOfShorthandForLonghand(CSSPropertyID, const Vector<StylePropertyShorthand>&);
+unsigned indexOfShorthandForLonghand(CSSPropertyID, const StylePropertyShorthandVector&);
bool isShorthandCSSProperty(CSSPropertyID);
Modified: trunk/Source/WebCore/css/makeprop.pl (201558 => 201559)
--- trunk/Source/WebCore/css/makeprop.pl 2016-06-01 17:38:04 UTC (rev 201558)
+++ trunk/Source/WebCore/css/makeprop.pl 2016-06-01 18:14:25 UTC (rev 201559)
@@ -1005,7 +1005,7 @@
EOF
print SHORTHANDS_CPP << "EOF";
-Vector<StylePropertyShorthand> matchingShorthandsForLonghand(CSSPropertyID propertyID)
+StylePropertyShorthandVector matchingShorthandsForLonghand(CSSPropertyID propertyID)
{
switch (propertyID) {
EOF
@@ -1013,7 +1013,7 @@
sub constructShorthandsVector {
my $shorthands = shift;
- my $vector = "Vector<StylePropertyShorthand>{";
+ my $vector = "StylePropertyShorthandVector{";
foreach my $i (0 .. $#$shorthands) {
$vector .= ", " unless $i == 0;
$vector .= lcfirst($nameToId{$shorthands->[$i]}) . "Shorthand()";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes