Bug 126215 - Replace WTF::ThreadingOnce with std::call_once
Summary: Replace WTF::ThreadingOnce with std::call_once
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-24 09:55 PST by Anders Carlsson
Modified: 2013-12-30 11:29 PST (History)
4 users (show)

See Also:


Attachments
Patch (9.26 KB, patch)
2013-12-24 12:48 PST, Anders Carlsson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.