Bug 84268 - CSSValuePool: Make numeric value caches fixed-size arrays.
Summary: CSSValuePool: Make numeric value caches fixed-size arrays.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-18 12:57 PDT by Andreas Kling
Modified: 2012-04-18 14:02 PDT (History)
3 users (show)

See Also:


Attachments
Patch (4.58 KB, patch)
2012-04-18 12:58 PDT, Andreas Kling
eric: review-
Details | Formatted Diff | Diff
Patch with less derp (4.58 KB, patch)
2012-04-18 13:05 PDT, Andreas Kling
koivisto: review-
Details | Formatted Diff | Diff
Patch :'( (4.59 KB, patch)
2012-04-18 13:44 PDT, Andreas Kling
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2012-04-18 12:57:33 PDT
This would be more space and time efficient than using hash maps.
Comment 1 Andreas Kling 2012-04-18 12:58:58 PDT
Created attachment 137745 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-04-18 13:01:47 PDT
Comment on attachment 137745 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=137745&action=review

> Source/WebCore/css/CSSValuePool.cpp:87
> +    if (value < 0 || value > maximumCacheableIntegerValue)

Shouldn't this be >= max?
Comment 3 Eric Seidel (no email) 2012-04-18 13:03:07 PDT
Comment on attachment 137745 [details]
Patch

Farts.  It appears you're running off the end of your array by allowing 256.
Comment 4 Andreas Kling 2012-04-18 13:05:35 PDT
Created attachment 137749 [details]
Patch with less derp
Comment 5 Antti Koivisto 2012-04-18 13:23:37 PDT
Comment on attachment 137749 [details]
Patch with less derp

View in context: https://bugs.webkit.org/attachment.cgi?id=137749&action=review

> Source/WebCore/css/CSSValuePool.h:73
> +    static const int maximumCacheableIntegerValue = 256;
> +
> +    RefPtr<CSSPrimitiveValue> m_pixelValueCache[maximumCacheableIntegerValue];
> +    RefPtr<CSSPrimitiveValue> m_percentValueCache[maximumCacheableIntegerValue];
> +    RefPtr<CSSPrimitiveValue> m_numberValueCache[maximumCacheableIntegerValue];

Naming is off. Your maximumCacheableIntegerValue is not actually cacheable.
Comment 6 Andreas Kling 2012-04-18 13:44:41 PDT
Created attachment 137758 [details]
Patch :'(
Comment 7 Antti Koivisto 2012-04-18 13:45:49 PDT
Comment on attachment 137758 [details]
Patch :'(

r=me
Comment 8 Andreas Kling 2012-04-18 14:02:25 PDT
Committed r114558: <http://trac.webkit.org/changeset/114558>