Bug 126215

Summary: Replace WTF::ThreadingOnce with std::call_once
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cmarcelo, commit-queue, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Anders Carlsson 2013-12-24 09:55:32 PST
Replace WTF::ThreadingOnce with std::call_once
Comment 1 Anders Carlsson 2013-12-24 12:48:28 PST
Created attachment 219977 [details]
Patch
Comment 2 WebKit Commit Bot 2013-12-24 12:51:12 PST
Attachment 219977 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source/JavaScriptCore/dfg/DFGWorklist.cpp', u'Source/JavaScriptCore/runtime/InitializeThreading.cpp', u'Source/WTF/ChangeLog', u'Source/WTF/GNUmakefile.list.am', u'Source/WTF/wtf/CompilationThread.cpp', u'Source/WTF/wtf/ThreadingOnce.h', '--commit-queue']" exit_code: 1
ERROR: Source/JavaScriptCore/runtime/InitializeThreading.cpp:55:  Missing space before {  [whitespace/braces] [5]
ERROR: Source/WTF/wtf/CompilationThread.cpp:41:  Missing space before {  [whitespace/braces] [5]
Total errors found: 2 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Sam Weinig 2013-12-24 18:32:31 PST
Not that it matters in these places much, but how does the performance of std::call_once compare to pthread_once and dispatch_once? I see in libc++'s implementation there is comment stating it should consider moving to dispatch_once (presumably for performance reasons) http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/mutex.cpp?view=markup#l209.  The comment seems predicated on dispatch_once_f supporting c++ exceptions, but perhaps the maintainers would consider an optimized version when exceptions were disabled as they are with WebKit.
Comment 4 Anders Carlsson 2013-12-30 10:54:43 PST
(In reply to comment #3)
> Not that it matters in these places much, but how does the performance of std::call_once compare to pthread_once and dispatch_once?

It's faster than pthread_once since the first check ends up being inlined.
Comment 5 WebKit Commit Bot 2013-12-30 11:29:11 PST
Comment on attachment 219977 [details]
Patch

Clearing flags on attachment: 219977

Committed r161146: <http://trac.webkit.org/changeset/161146>
Comment 6 WebKit Commit Bot 2013-12-30 11:29:13 PST
All reviewed patches have been landed.  Closing bug.