Bug 207666

Summary: CSSValuePool's constant CSS values should not be allocated dynamically (and same for Vectors)
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: CSSAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, macpherson, mark.lam, menard, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=204520
Attachments:
Description Flags
Patch
none
Patch mark.lam: review+

Description Yusuke Suzuki 2020-02-12 14:42:12 PST
This causes memory regression.
Comment 1 Yusuke Suzuki 2020-02-12 14:43:35 PST
Let's introduce static CSSValues which can be shared by multiple threads, the concept is the same to StaticStringImpl.
Comment 2 Yusuke Suzuki 2020-02-12 14:44:54 PST
Further aggressive thing is like, encoding some of CSSValues into a pointer and using it as a value. But for now, let's just start fixing it.
Comment 3 Radar WebKit Bug Importer 2020-02-12 16:09:46 PST
<rdar://problem/59405553>
Comment 4 Yusuke Suzuki 2020-02-12 16:20:17 PST
Created attachment 390583 [details]
Patch
Comment 5 Yusuke Suzuki 2020-02-12 16:34:57 PST
Created attachment 390588 [details]
Patch
Comment 6 Mark Lam 2020-02-12 16:48:55 PST
Comment on attachment 390583 [details]
Patch

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

> Source/WebCore/css/CSSValue.h:68
> +        // Custoized deref() to ensure operator delete is called on

/Custoized/Customized/

> Source/WebCore/css/CSSValuePool.h:51
> +    friend class WTF::LazyNeverDestroyed<StaticCSSValuePool>;

The WTF qualifier here is not needed.
Comment 7 Mark Lam 2020-02-12 16:50:39 PST
Comment on attachment 390588 [details]
Patch

r=me with fixes for previously posted comments.
Comment 8 Yusuke Suzuki 2020-02-12 17:06:32 PST
Comment on attachment 390588 [details]
Patch

Thanks, fixed.
Comment 9 Yusuke Suzuki 2020-02-12 17:11:15 PST
Committed r256494: <https://trac.webkit.org/changeset/256494>