RESOLVED FIXED 71012
Use StringHasher to generate the matched declaration cache hash
https://bugs.webkit.org/show_bug.cgi?id=71012
Summary Use StringHasher to generate the matched declaration cache hash
Antti Koivisto
Reported 2011-10-27 06:15:03 PDT
It is faster and better than the current custom function.
Attachments
patch (1.64 KB, patch)
2011-10-27 06:20 PDT, Antti Koivisto
kenneth: review+
zero initialize the matched declaration struct (2.61 KB, patch)
2011-10-28 08:00 PDT, Antti Koivisto
sam: review+
gustavo: commit-queue-
Antti Koivisto
Comment 1 2011-10-27 06:20:38 PDT
Kenneth Rohde Christiansen
Comment 2 2011-10-27 06:22:19 PDT
Comment on attachment 112672 [details] patch r=me
Antti Koivisto
Comment 3 2011-10-27 08:04:14 PDT
Darin Adler
Comment 4 2011-10-27 10:05:07 PDT
Comment on attachment 112672 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=112672&action=review > Source/WebCore/css/CSSStyleSelector.cpp:2139 > + return StringHasher::hashMemory(declarations, sizeof(MatchedStyleDeclaration) * size); Is there a possibility that this will hash uninitialized memory between the fields of the MatchedStyleDeclaration structure or between elements of the array?
Antti Koivisto
Comment 5 2011-10-27 13:22:43 PDT
(In reply to comment #4) > (From update of attachment 112672 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=112672&action=review > > > Source/WebCore/css/CSSStyleSelector.cpp:2139 > > + return StringHasher::hashMemory(declarations, sizeof(MatchedStyleDeclaration) * size); > > Is there a possibility that this will hash uninitialized memory between the fields of the MatchedStyleDeclaration structure or between elements of the array? There shouldn't be uninitialize memory between the fields of the MatchedStyleDeclaration struct due to the specific ordering and types used. There won't be any space between the elements of the array as that is forbidden by the standard. However there might be padding at the end of the struct and I'm unsure if that is guaranteed to be zero-initialized here. If not, it seems to me that the only way to use hashMemory over structs is to explicitly zero-initialize their memory beforehand.
Antti Koivisto
Comment 6 2011-10-28 08:00:37 PDT
Created attachment 112865 [details] zero initialize the matched declaration struct The other option would be to use vector traits. However those seemed to be geared towards optimization and being more explicit seemed better.
Antti Koivisto
Comment 7 2011-10-28 08:01:31 PDT
Reopening.
Gustavo Noronha (kov)
Comment 8 2011-10-28 08:31:00 PDT
Comment on attachment 112865 [details] zero initialize the matched declaration struct Attachment 112865 [details] did not pass gtk-ews (gtk): Output: http://queues.webkit.org/results/10241057
Antti Koivisto
Comment 9 2011-10-31 04:25:19 PDT
Added explicit zero-initialization, http://trac.webkit.org/changeset/98844
Note You need to log in before you can comment on or make changes to this bug.