Title: [114474] trunk/Source/WebCore
- Revision
- 114474
- Author
- kl...@webkit.org
- Date
- 2012-04-17 19:49:54 -0700 (Tue, 17 Apr 2012)
Log Message
CSSValuePool: Made identifier value cache a fixed-size array.
<http://webkit.org/b/84219>
Reviewed by Antti Koivisto.
Change the identifier CSSPrimitiveValue cache in CSSValuePool from a HashMap to a
fixed-size array of RefPtr<CSSPrimitiveValue>s.
We have ~700 values total, so this is quite space efficient now that the CSSValuePool
is globally shared. More importantly it avoids a hash lookup every time we need an
identifier value.
* css/CSSValuePool.h:
* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::createIdentifierValue):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (114473 => 114474)
--- trunk/Source/WebCore/ChangeLog 2012-04-18 00:52:40 UTC (rev 114473)
+++ trunk/Source/WebCore/ChangeLog 2012-04-18 02:49:54 UTC (rev 114474)
@@ -1,3 +1,21 @@
+2012-04-17 Andreas Kling <kl...@webkit.org>
+
+ CSSValuePool: Made identifier value cache a fixed-size array.
+ <http://webkit.org/b/84219>
+
+ Reviewed by Antti Koivisto.
+
+ Change the identifier CSSPrimitiveValue cache in CSSValuePool from a HashMap to a
+ fixed-size array of RefPtr<CSSPrimitiveValue>s.
+
+ We have ~700 values total, so this is quite space efficient now that the CSSValuePool
+ is globally shared. More importantly it avoids a hash lookup every time we need an
+ identifier value.
+
+ * css/CSSValuePool.h:
+ * css/CSSValuePool.cpp:
+ (WebCore::CSSValuePool::createIdentifierValue):
+
2012-04-17 Antoine Labour <pi...@chromium.org>
[Chromium] Clean up texture ids on the impl side when losing the context
Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (114473 => 114474)
--- trunk/Source/WebCore/css/CSSValuePool.cpp 2012-04-18 00:52:40 UTC (rev 114473)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp 2012-04-18 02:49:54 UTC (rev 114474)
@@ -57,11 +57,9 @@
if (ident <= 0 || ident >= numCSSValueKeywords)
return CSSPrimitiveValue::createIdentifier(ident);
- RefPtr<CSSPrimitiveValue> dummyValue;
- IdentifierValueCache::AddResult entry = m_identifierValueCache.add(ident, dummyValue);
- if (entry.isNewEntry)
- entry.iterator->second = CSSPrimitiveValue::createIdentifier(ident);
- return entry.iterator->second;
+ if (!m_identifierValueCache[ident])
+ m_identifierValueCache[ident] = CSSPrimitiveValue::createIdentifier(ident);
+ return m_identifierValueCache[ident];
}
PassRefPtr<CSSPrimitiveValue> CSSValuePool::createColorValue(unsigned rgbValue)
Modified: trunk/Source/WebCore/css/CSSValuePool.h (114473 => 114474)
--- trunk/Source/WebCore/css/CSSValuePool.h 2012-04-18 00:52:40 UTC (rev 114473)
+++ trunk/Source/WebCore/css/CSSValuePool.h 2012-04-18 02:49:54 UTC (rev 114474)
@@ -29,6 +29,7 @@
#include "CSSInheritedValue.h"
#include "CSSInitialValue.h"
#include "CSSPrimitiveValue.h"
+#include "CSSValueKeywords.h"
#include <wtf/text/AtomicStringHash.h>
#include <wtf/HashMap.h>
#include <wtf/RefPtr.h>
@@ -57,8 +58,7 @@
RefPtr<CSSInitialValue> m_implicitInitialValue;
RefPtr<CSSInitialValue> m_explicitInitialValue;
- typedef HashMap<int, RefPtr<CSSPrimitiveValue> > IdentifierValueCache;
- IdentifierValueCache m_identifierValueCache;
+ RefPtr<CSSPrimitiveValue> m_identifierValueCache[numCSSValueKeywords];
typedef HashMap<unsigned, RefPtr<CSSPrimitiveValue> > ColorValueCache;
ColorValueCache m_colorValueCache;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes