Summary: | Add "explicit operator bool" to ScratchRegisterAllocator::PreservedState | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Saam Barati <saam> | ||||
Component: | JavaScriptCore | Assignee: | Saam Barati <saam> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | commit-queue, keith_miller, mark.lam, msaboff | ||||
Priority: | P2 | ||||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
Saam Barati
2015-12-16 08:52:14 PST
Created attachment 267460 [details]
patch
Comment on attachment 267460 [details]
patch
r=me
Comment on attachment 267460 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=267460&action=review > Source/JavaScriptCore/jit/ScratchRegisterAllocator.cpp:130 > + RELEASE_ASSERT(!!preservedState); Really surprised that we need !! here. I think that means there is something wrong with the RELEASE_ASSERT macro. > Source/JavaScriptCore/jit/ScratchRegisterAllocator.h:82 > + explicit operator bool() const { return numberOfBytesPreserved != std::numeric_limits<unsigned>::max(); } I am interested to learn that this is sufficient by itself without also defining operator! for the class. I think this means we can remove many of our operator! definitions throughout the WebKit project. Comment on attachment 267460 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=267460&action=review >> Source/JavaScriptCore/jit/ScratchRegisterAllocator.cpp:130 >> + RELEASE_ASSERT(!!preservedState); > > Really surprised that we need !! here. I think that means there is something wrong with the RELEASE_ASSERT macro. We don't. I just do this for stylistic reasons (or lack thereof). I happen to like the explicitness of how !! looks when testing the truthiness of something. This is probably overkill inside an assert. >> Source/JavaScriptCore/jit/ScratchRegisterAllocator.h:82 >> + explicit operator bool() const { return numberOfBytesPreserved != std::numeric_limits<unsigned>::max(); } > > I am interested to learn that this is sufficient by itself without also defining operator! for the class. I think this means we can remove many of our operator! definitions throughout the WebKit project. I think one of the main benefits of "explicit operator bool" is that it eliminates most of the need for operator!. landed in: http://trac.webkit.org/changeset/194158 |