We should assert we only get valid PreservedStates in restore reused registers.
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