RESOLVED FIXED 142429
Merge TrivialAtom and CharacterSet into a Term abstraction, prepare Term for composition
https://bugs.webkit.org/show_bug.cgi?id=142429
Summary Merge TrivialAtom and CharacterSet into a Term abstraction, prepare Term for ...
Benjamin Poulain
Reported 2015-03-06 20:47:04 PST
Merge TrivialAtom and CharacterSet into a Term abstraction, prepare Term for composition
Attachments
Patch (33.37 KB, patch)
2015-03-06 20:53 PST, Benjamin Poulain
darin: review+
Benjamin Poulain
Comment 1 2015-03-06 20:53:17 PST
WebKit Commit Bot
Comment 2 2015-03-06 20:55:02 PST
Attachment 248139 [details] did not pass style-queue: ERROR: Source/WebCore/contentextensions/URLFilterParser.cpp:487: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 3 2015-03-07 09:24:33 PST
Comment on attachment 248139 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248139&action=review > Source/WebCore/contentextensions/URLFilterParser.cpp:51 > + enum class TermType : uint8_t { > + Empty, > + Deleted, > + CharacterSet > + }; This private enum can be in the private: section. There’s no need to have it at the top of the class. > Source/WebCore/contentextensions/URLFilterParser.cpp:55 > + Term() > + { > + } Why are all the function bodies in the class? To me this seems to make the class harder to read. > Source/WebCore/contentextensions/URLFilterParser.cpp:281 > + ~AtomData() > + { > + } Is this explicit definition of the destructor needed? If so, why?
Alex Christensen
Comment 4 2015-03-09 14:06:01 PDT
Comment on attachment 248139 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248139&action=review > Source/WebCore/contentextensions/URLFilterParser.cpp:261 > + BitVector characters { 128 }; If I understand this correctly, the whole point of using a union, placement new, and explicitly calling destructors is to avoid allocating and deallocating a BitVector for empty/deleted slots in a hash table. Won't this all be excessive if we switch to using two uint64_t's?
Benjamin Poulain
Comment 5 2015-03-09 14:07:44 PDT
Benjamin Poulain
Comment 6 2015-03-09 14:08:46 PDT
(In reply to comment #4) > Comment on attachment 248139 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=248139&action=review > > > Source/WebCore/contentextensions/URLFilterParser.cpp:261 > > + BitVector characters { 128 }; > > If I understand this correctly, the whole point of using a union, placement > new, and explicitly calling destructors is to avoid allocating and > deallocating a BitVector for empty/deleted slots in a hash table. Won't > this all be excessive if we switch to using two uint64_t's? The union is there to support other terms without rewriting everything.
Benjamin Poulain
Comment 7 2015-03-09 14:13:37 PDT
(In reply to comment #3) > Comment on attachment 248139 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=248139&action=review > > > Source/WebCore/contentextensions/URLFilterParser.cpp:51 > > + enum class TermType : uint8_t { > > + Empty, > > + Deleted, > > + CharacterSet > > + }; > > This private enum can be in the private: section. There’s no need to have it > at the top of the class. IIRC, some compiler complained about it when it was at the end of the file. Clang seems fine with it, let's try again. > > Source/WebCore/contentextensions/URLFilterParser.cpp:55 > > + Term() > > + { > > + } > > Why are all the function bodies in the class? To me this seems to make the > class harder to read. JavaScriptCore users that style for private generators so I copied that here. > > Source/WebCore/contentextensions/URLFilterParser.cpp:281 > > + ~AtomData() > > + { > > + } > > Is this explicit definition of the destructor needed? If so, why? It is. The union has non trivial destructor so they need to be invoked explicitly. In this case, the destructor ignore the cleanup and the destroy() function takes care of it.
Note You need to log in before you can comment on or make changes to this bug.