Help the CSE a bit.
Created attachment 212274 [details] Patch idea
Comment on attachment 212274 [details] Patch idea View in context: https://bugs.webkit.org/attachment.cgi?id=212274&action=review Did you test? How well did this work? > Source/WTF/wtf/Compiler.h:198 > +#define WTF_PURE_FUNCTION __attribute__ ((pure)) I never know if we should include the WTF prefixes. I would not like it if it was WTF_OVERRIDE, for example. Also, I seem to recall that __attribute__((__pure__)) does the same thing and is a little more safe if someone has a macro named "pure".
(In reply to comment #2) > (From update of attachment 212274 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=212274&action=review > > Did you test? How well did this work? It knocks 4800 bytes off of the binary size, and does succeed in coalescing multiple function calls in the same function. Of course the real value is in calling threadGlobalData() as little as possible, since that has to do a pthread_getspecific(). > > Source/WTF/wtf/Compiler.h:198 > > +#define WTF_PURE_FUNCTION __attribute__ ((pure)) > > I never know if we should include the WTF prefixes. I would not like it if it was WTF_OVERRIDE, for example. Let's just call it PURE_FUNCTION. > Also, I seem to recall that __attribute__((__pure__)) does the same thing and is a little more safe if someone has a macro named "pure". Good idea.
Created attachment 212300 [details] Land for patching
Comment on attachment 212300 [details] Land for patching Clearing flags on attachment: 212300 Committed r156246: <http://trac.webkit.org/changeset/156246>
All reviewed patches have been landed. Closing bug.
Comment on attachment 212300 [details] Land for patching View in context: https://bugs.webkit.org/attachment.cgi?id=212300&action=review Pure has plenty of advantages for function used cross-compilation unit. I am really happy you added a macro for it. > Source/WTF/ChangeLog:11 > + Marking a function pure means that the compiler's CSE pass is free to coalesce > + multiple calls to this function because it has no globally observable side > + effects beyond the first call. I don't think the definition of pure has anything to do with the first call though. I could not find a formal definition from a quick search in Clang's doc.