Force StaticStringImpl constructor to use the constexpr versions of StringImplShape...
[WebKit-https.git] / Source / WTF / ChangeLog
1 2017-05-09  Mark Lam  <mark.lam@apple.com>
2
3         Force StaticStringImpl constructor to use the constexpr versions of StringImplShape constructors.
4         https://bugs.webkit.org/show_bug.cgi?id=171861
5
6         Reviewed by Yusuke Suzuki.
7
8         This is strictly necessary for correctness of the StaticStringImpl implementation.
9         We force the constructor selection by adding an extra dummy argument to the
10         constexpr versions of the StringImplShape constructors to disambiguate them from
11         the non-constexpr versions.
12
13         * wtf/text/StringImpl.h:
14         (WTF::StringImplShape::StringImplShape):
15         (WTF::StringImpl::StaticStringImpl::StaticStringImpl):
16
17 2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
18
19         Upstream the WPE port
20         https://bugs.webkit.org/show_bug.cgi?id=171110
21
22         Reviewed by Alex Christensen.
23
24         * wtf/Platform.h:
25         * wtf/PlatformWPE.cmake: Added.
26         * wtf/glib/RunLoopSourcePriority.h:
27
28 2017-05-08  Mark Lam  <mark.lam@apple.com>
29
30         Speculative Windows build fix after r216428.
31         https://bugs.webkit.org/show_bug.cgi?id=171776
32
33         Not reviewed.
34
35         * wtf/StackTrace.h:
36
37 2017-05-08  Mark Lam  <mark.lam@apple.com>
38
39         Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
40         https://bugs.webkit.org/show_bug.cgi?id=171776
41
42         Reviewed by Keith Miller.
43
44         1. Add an option to skip some number of top frames when capturing the StackTrace.
45         2. Add an option to use an indentation string when dumping the StackTrace.
46
47         * wtf/StackTrace.cpp:
48         (WTF::StackTrace::captureStackTrace):
49         (WTF::StackTrace::dump):
50         * wtf/StackTrace.h:
51
52 2017-05-05  Yusuke Suzuki  <utatane.tea@gmail.com>
53
54         [WTF] Use memoryFootprint for MemoryUsage retrieval in Linux
55         https://bugs.webkit.org/show_bug.cgi?id=171757
56
57         Reviewed by Michael Catanzaro.
58
59         This patch leverages memoryFootprint() to retrieve physical footprint in Linux.
60
61         * wtf/linux/MemoryPressureHandlerLinux.cpp:
62         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
63
64 2017-05-05  Don Olmstead  <don.olmstead@am.sony.com>
65
66         [WTF] Do not export deleted constructor in StringView
67         https://bugs.webkit.org/show_bug.cgi?id=171751
68
69         Reviewed by Alexey Proskuryakov.
70
71         * wtf/text/StringView.h:
72
73 2017-05-05  Yusuke Suzuki  <utatane.tea@gmail.com>
74
75         [GTK][JSCOnly] Merge MainThread implementations and use generic one
76         https://bugs.webkit.org/show_bug.cgi?id=171738
77
78         Reviewed by Michael Catanzaro.
79
80         GLib MainThread implementation is generic enough to be used in JSCOnly.
81         We move it to generic/ and GTK (GLib ports) and JSCOnly use it.
82         And we also drop GLib MainThread's isMainThread function because
83         generic thread ID one is enough.
84
85         This patch also cleans up initializing main thread code by using std::call_once.
86
87         * wtf/MainThread.cpp:
88         (WTF::initializeMainThread):
89         (WTF::isMainThread):
90         (WTF::initializeMainThreadToProcessMainThread):
91         (WTF::initializeWebThread):
92         (WTF::canAccessThreadLocalDataForThread):
93         (WTF::initializeMainThreadOnce): Deleted.
94         (WTF::initializeMainThreadToProcessMainThreadOnce): Deleted.
95         (WTF::initializeWebThreadOnce): Deleted.
96         * wtf/PlatformGTK.cmake:
97         * wtf/PlatformJSCOnly.cmake:
98         * wtf/generic/MainThreadGeneric.cpp:
99         (WTF::MainThreadDispatcher::MainThreadDispatcher):
100         (WTF::MainThreadDispatcher::schedule):
101         (WTF::MainThreadDispatcher::fired):
102         (WTF::scheduleDispatchFunctionsOnMainThread):
103         * wtf/glib/MainThreadGLib.cpp: Removed.
104
105 2017-05-04  Commit Queue  <commit-queue@webkit.org>
106
107         Unreviewed, rolling out r216206.
108         https://bugs.webkit.org/show_bug.cgi?id=171714
109
110         Multiple LayoutTests crashing in Document::page() (Requested
111         by ap on #webkit).
112
113         Reverted changeset:
114
115         "Remove support for legacy Notifications"
116         https://bugs.webkit.org/show_bug.cgi?id=171487
117         http://trac.webkit.org/changeset/216206
118
119 2017-05-04  Don Olmstead  <don.olmstead@am.sony.com>
120
121         [Win] Remove redundant macros that are set in the CMake config
122         https://bugs.webkit.org/show_bug.cgi?id=171571
123
124         Reviewed by Brent Fulgham.
125
126         * config.h:
127
128 2017-05-04  Mark Lam  <mark.lam@apple.com>
129
130         NeverDestroyed<String>(ASCIILiteral(...)) is not thread safe.
131         https://bugs.webkit.org/show_bug.cgi?id=171586
132         <rdar://problem/31873190>
133
134         Reviewed by Yusuke Suzuki.
135
136         StaticStringImpl is meant to be thread-safe.  However, it has a bug: it did not
137         set the s_hashFlagDidReportCost flag.  As a result, if cost() is called on it,
138         different threads may try to change its flags bits at the same time.  This patch
139         changes StaticStringImpl to always set the s_hashFlagDidReportCost flag.
140
141         Also factored out StringImplShape and made StringImpl and StaticStringImpl extend
142         it.  This makes it more clear that the 2 are intended to have the same shape.
143         Note: there is already a static_assert that the 2 have the same size.  This
144         change also ensures that they both have the same shape, which is a requirement in
145         order for StaticStringImpl to work.
146
147         Introduced the MAKE_STATIC_STRING_IMPL macro as a convenient way to instantiate
148         StaticStringImpls from literal strings.  This allows us to trivially change
149
150             NeverDestroyed<String> myString(ASCIILiteral("myString"));
151
152         to ...
153
154             NeverDestroyed<String> myString(MAKE_STATIC_STRING_IMPL("myString"));
155
156         and by so doing, make it thread-safe.
157
158         MAKE_STATIC_STRING_IMPL instantiates a lambda function to create the static
159         StaticStringImpls.
160
161         * wtf/text/StringImpl.h:
162         (WTF::StringImplShape::StringImplShape):
163         (WTF::StringImpl::StringImpl):
164         (WTF::StringImpl::cost):
165         (WTF::StringImpl::setHash):
166         (WTF::StringImpl::StaticStringImpl::StaticStringImpl):
167         (WTF::StringImpl::StaticStringImpl::operator StringImpl&):
168         * wtf/text/WTFString.h:
169         (WTF::String::String):
170         * wtf/text/icu/TextBreakIteratorICU.h:
171         (WTF::caretRules):
172
173 2017-05-04  Sam Weinig  <sam@webkit.org>
174
175         Remove support for legacy Notifications
176         https://bugs.webkit.org/show_bug.cgi?id=171487
177
178         Reviewed by Jon Lee.
179
180         * wtf/FeatureDefines.h:
181         Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
182
183 2017-05-04  Yusuke Suzuki  <utatane.tea@gmail.com>
184
185         [GTK][JSCOnly] Implement memoryFootprint for Linux
186         https://bugs.webkit.org/show_bug.cgi?id=171680
187
188         Reviewed by Carlos Alberto Lopez Perez.
189
190         Darwin's phys_footprint returns the amount of dirty anonymous memory in the process.
191         This patch implements the same thing in Linux by reading /proc/self/smaps.
192         We sum sizes of private dirty pages in anonymous regions.
193
194         * wtf/MemoryFootprint.cpp:
195         (WTF::forEachLine):
196         (WTF::memoryFootprint):
197
198 2017-05-03  Mark Lam  <mark.lam@apple.com>
199
200         Use the CLoop for CPU(ARM64E).
201         https://bugs.webkit.org/show_bug.cgi?id=171620
202         <rdar://problem/31973027>
203
204         Reviewed by Geoffrey Garen.
205
206         * wtf/Platform.h:
207
208 2017-05-02  Daniel Bates  <dabates@apple.com>
209
210         Fix the build after <https://trac.webkit.org/changeset/216102>
211         (https://bugs.webkit.org/show_bug.cgi?id=170925)
212
213         Export into global scope ASCIICaseInsensitiveStringViewHashTranslator.
214
215         Also fix indentation of member functions of ASCIICaseInsensitiveStringViewHashTranslator.
216
217         * wtf/text/StringHash.h:
218
219 2017-05-02  Daniel Bates  <dabates@apple.com>
220
221         Using StringView.split() instead of String.split() in some places
222         https://bugs.webkit.org/show_bug.cgi?id=170925
223
224         Reviewed by Darin Adler and Sam Weinig.
225
226         * wtf/HashMap.h: Add HashMap::get() overload that takes a HashTranslator.
227         * wtf/text/StringHash.h:
228         (WebCore::ASCIICaseInsensitiveStringViewHashTranslator::hash): Added.
229         (WebCore::ASCIICaseInsensitiveStringViewHashTranslator::equal): Added.
230
231 2017-05-01  Dan Bernstein  <mitz@apple.com>
232
233         [Xcode] It’s easy to accidentally install a WTF header outside /usr/local/include/wtf
234         https://bugs.webkit.org/show_bug.cgi?id=171533
235
236         Reviewed by Andy Estes.
237
238         * WTF.xcodeproj/project.pbxproj: Removed the WTF target’s Headers build phase. Its existence
239           was making it easy to accidentally add a header to the target and make it Private, which
240           would have Xcode install a copy of it right under /usr/local/include, in addition to the
241           copy installed under /usr/local/include/wtf by the Copy WTF Headers target.
242           Also got rid of INSTALL_PATH_PREFIX in the script build phase in the Copy WTF Headers
243           target, because it is being never set anymore.
244
245 2017-05-01  Dan Bernstein  <mitz@apple.com>
246
247         WTF installs an extra copy of a header outside /usr/local/include/wtf
248
249         * WTF.xcodeproj/project.pbxproj: Demoted CPUTime.h from Private to Project.
250
251 2017-05-01  Daniel Bates  <dabates@apple.com>
252
253         Cleanup: Change ASCIICaseInsensitiveHash from a class to a struct
254         https://bugs.webkit.org/show_bug.cgi?id=171460
255
256         Reviewed by Sam Weinig.
257
258         All of the members of ASCIICaseInsensitiveHash have public visibility.
259         We are underutilizing the purpose of a class - defaults to private
260         visibility of members. We should change ASCIICaseInsensitiveHash from
261         a class to a struct, which by definition defaults to public visibility
262         for members.
263
264         * wtf/text/StringHash.h:
265
266 2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
267
268         Move WebCore CPUTime to WTF and implement it in all the platforms
269         https://bugs.webkit.org/show_bug.cgi?id=171477
270
271         Reviewed by Chris Dumez.
272
273         We move WebCore::CPUTime to WTF::CPUTime since it is useful even in JSC
274         and it does not depend on any external libraries.
275         And we additionally implement WTF::CPUTime in all the platforms: Windows and Unix.
276
277         In CPUTime, instead of holding int64_t, we hold MonotonicTime and Seconds.
278
279         * WTF.xcodeproj/project.pbxproj:
280         * wtf/CMakeLists.txt:
281         * wtf/CPUTime.cpp: Copied from Source/WebCore/platform/CPUTime.cpp.
282         (WTF::CPUTime::percentageCPUUsageSince):
283         * wtf/CPUTime.h: Renamed from Source/WebCore/platform/CPUTime.h.
284         * wtf/PlatformEfl.cmake:
285         * wtf/PlatformGTK.cmake:
286         * wtf/PlatformJSCOnly.cmake:
287         * wtf/PlatformMac.cmake:
288         * wtf/PlatformWin.cmake:
289         * wtf/cocoa/CPUTimeCocoa.mm: Renamed from Source/WebCore/platform/cocoa/CPUTimeCocoa.mm.
290         (WTF::timeValueToMicroseconds):
291         (WTF::CPUTime::get):
292         * wtf/unix/CPUTimeUnix.cpp: Renamed from Source/WebCore/platform/CPUTime.cpp.
293         (WTF::timevalToSeconds):
294         (WTF::CPUTime::get):
295         * wtf/win/CPUTimeWin.cpp: Added.
296         (WTF::fileTimeToSeconds):
297         (WTF::CPUTime::get):
298
299 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
300
301         Add system trace points for Document::updateTouchEventRegions()
302         https://bugs.webkit.org/show_bug.cgi?id=171470
303         rdar://problem/31901239
304
305         Reviewed by Tim Horton.
306
307         Add trace markers for updateTouchEventRegions.
308
309         * wtf/SystemTracing.h:
310
311 2017-04-28  Daniel Bates  <dabates@apple.com>
312
313         Add StringView::toExistingAtomicString()
314         https://bugs.webkit.org/show_bug.cgi?id=171405
315
316         Reviewed by Andreas Kling.
317
318         Similar to the reasons for JSString::toExistingAtomicString() we should expose a way to
319         convert a StringView to an existing atomic string. Looking up an atomic string is more
320         efficient that creating one, which requires a lookup and memory allocation.
321
322         We are not making use of StringView::toExistingAtomicString() now, but will in the patch
323         for <https://bugs.webkit.org/show_bug.cgi?id=170925>.
324
325         * wtf/text/AtomicStringImpl.cpp:
326         (WTF::AtomicStringImpl::lookUp): Modified to take a const LChar*/UChar*.
327         (WTF::AtomicStringImpl::lookUpInternal): Renamed to AtomicStringImpl::lookup() to avoid
328         an extra function call.
329         * wtf/text/AtomicStringImpl.h:
330         * wtf/text/StringView.h:
331         (WTF::StringView::toExistingAtomicString): Added.
332
333 2017-04-28  Chris Dumez  <cdumez@apple.com>
334
335         Update DOMTokenList.replace() to match the latest DOM specification
336         https://bugs.webkit.org/show_bug.cgi?id=171388
337
338         Reviewed by Alex Christensen.
339
340         Add Vector::findMatching() API which takes in a lambda function for convenience.
341         Add optional startIndex parameter to Vector::removeFirstMatching() / removeAllMatching()
342         to remove items only after given index.
343
344         * wtf/Vector.h:
345         (WTF::minCapacity>::findMatching):
346         (WTF::minCapacity>::find):
347         (WTF::minCapacity>::removeFirstMatching):
348         (WTF::minCapacity>::removeAllMatching):
349
350 2017-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
351
352         Move UUID from WebCore/platform to WTF
353         https://bugs.webkit.org/show_bug.cgi?id=171372
354
355         Reviewed by Michael Catanzaro.
356
357         * WTF.xcodeproj/project.pbxproj:
358         * wtf/CMakeLists.txt:
359         * wtf/UUID.cpp: Renamed from Source/WebCore/platform/UUID.cpp.
360         * wtf/UUID.h: Renamed from Source/WebCore/platform/UUID.h.
361
362 2017-04-26  Keith Miller  <keith_miller@apple.com>
363
364         LocklessBag needs a destructor
365         https://bugs.webkit.org/show_bug.cgi?id=171334
366
367         Reviewed by Mark Lam.
368
369         Currently, if the bag is destructed any remaining nodes in the bag will
370         be leaked.
371
372         * wtf/LocklessBag.h:
373         (WTF::LocklessBag::consumeAll):
374         (WTF::LocklessBag::~LocklessBag):
375         * wtf/threads/Signals.cpp:
376         (WTF::jscSignalHandler):
377         (WTF::installSignalHandler):
378
379 2017-04-26  Don Olmstead  <don.olmstead@am.sony.com>
380
381         [ARM] Enable GCC visibility
382         https://bugs.webkit.org/show_bug.cgi?id=171296
383
384         Reviewed by Michael Catanzaro.
385
386         * wtf/Platform.h:
387
388 2017-04-26  Yusuke Suzuki  <utatane.tea@gmail.com>
389
390         sendMessageScoped's signal handler calls LocklessBag::consumeAll, which causes heap deallocation in signal handler and leads deadlock
391         https://bugs.webkit.org/show_bug.cgi?id=171319
392
393         Reviewed by Keith Miller.
394
395         In sendMessageScoped, we call LocklessBag<SignalHandler>::consumeAll `thread->threadMessages().consumeAll()`.
396         In LocklessBag::consumeAll, we call `delete` on Nodes.
397         The problem is that this is called under the context of signal handler. Thus, when calling this, the original
398         thread may hold the lock in bmalloc. In that case, this `delete` call attempts to lock the heap lock recursively,
399         and causes deadlock.
400
401         Instead, this patch transfers the LocklessBag's Node to the sender thread. And the sender thread deletes it instead.
402
403         * wtf/LocklessBag.h:
404         (WTF::LocklessBag::consumeAllWithNode):
405         * wtf/ThreadMessage.cpp:
406         (WTF::ThreadMessageData::ThreadMessageData):
407         (WTF::sendMessageScoped):
408
409 2017-04-25  Don Olmstead  <don.olmstead@am.sony.com>
410
411         [Win] Use Clang's __has_declspec_attribute for export macros
412         https://bugs.webkit.org/show_bug.cgi?id=171240
413
414         Reviewed by Alex Christensen.
415
416         * wtf/Compiler.h:
417         * wtf/ExportMacros.h:
418         * wtf/Platform.h:
419
420 2017-04-25  Keith Miller  <keith_miller@apple.com>
421
422         Our signal handler shouldn't print when sigaction succeeds
423         https://bugs.webkit.org/show_bug.cgi?id=171286
424
425         Reviewed by Michael Saboff.
426
427         It turns out !result is not the same as !!result.
428
429         * wtf/threads/Signals.cpp:
430         (WTF::jscSignalHandler):
431
432 2017-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
433
434         Add performance test for FontCache::systemFallbackForCharacters()
435         https://bugs.webkit.org/show_bug.cgi?id=170842
436
437         Reviewed by Tim Horton.
438
439         * wtf/unicode/CharacterNames.h:
440
441 2017-04-24  Andy VanWagoner  <thetalecrafter@gmail.com>
442
443         Clean up ICU headers
444         https://bugs.webkit.org/show_bug.cgi?id=170997
445
446         Reviewed by JF Bastien.
447
448         Update all icu headers to 55.1
449
450         * icu/LICENSE: Update copyright
451         * icu/README: Explain ICU headers for OS X better
452         * icu/unicode/localpointer.h:
453         (LocalPointer::LocalPointer):
454         (LocalPointer::adoptInsteadAndCheckErrorCode):
455         * icu/unicode/platform.h:
456         * icu/unicode/putil.h:
457         * icu/unicode/std_string.h:
458         * icu/unicode/ubrk.h:
459         * icu/unicode/uchar.h:
460         * icu/unicode/ucnv.h:
461         * icu/unicode/ucol.h:
462         * icu/unicode/uconfig.h:
463         * icu/unicode/ucurr.h:
464         * icu/unicode/uloc.h:
465         * icu/unicode/umachine.h:
466         * icu/unicode/unistr.h:
467         (UnicodeString::getArrayStart):
468         (UnicodeString::UnicodeString):
469         (UnicodeString::hasShortLength):
470         (UnicodeString::getShortLength):
471         (UnicodeString::length):
472         (UnicodeString::getCapacity):
473         (UnicodeString::isBogus):
474         (UnicodeString::isWritable):
475         (UnicodeString::isBufferWritable):
476         (UnicodeString::getBuffer):
477         (UnicodeString::isEmpty):
478         (UnicodeString::setZeroLength):
479         (UnicodeString::setShortLength):
480         (UnicodeString::setLength):
481         (UnicodeString::setToEmpty):
482         (UnicodeString::remove):
483         * icu/unicode/urename.h:
484         * icu/unicode/uscript.h:
485         * icu/unicode/uset.h:
486         * icu/unicode/ustring.h:
487         * icu/unicode/utf8.h:
488         * icu/unicode/utypes.h:
489         * icu/unicode/uvernum.h:
490
491 2017-04-24  Yusuke Suzuki  <utatane.tea@gmail.com>
492
493         Unreviewed, fix Windows build after r215715
494         https://bugs.webkit.org/show_bug.cgi?id=171199
495
496         * wtf/StackTrace.h:
497
498 2017-04-24  Yusuke Suzuki  <utatane.tea@gmail.com>
499
500         [WTF] Move JSC tools/StackTrace to WTF and unify stack trace dump code
501         https://bugs.webkit.org/show_bug.cgi?id=171199
502
503         Reviewed by Mark Lam.
504
505         JSC tools/StackTrace's dump code is almost identical to WTF Assertions'
506         stack trace dump code. This patch moves tools/StackTrace to WTF and use
507         it in Assertions. It unifies the two duplicate implementations into one.
508
509         * WTF.xcodeproj/project.pbxproj:
510         * wtf/Assertions.cpp:
511         * wtf/CMakeLists.txt:
512         * wtf/Platform.h:
513         * wtf/StackTrace.cpp: Renamed from Source/JavaScriptCore/tools/StackTrace.cpp.
514         (WTF::StackTrace::captureStackTrace):
515         (WTF::StackTrace::dump):
516         * wtf/StackTrace.h: Copied from Source/JavaScriptCore/tools/StackTrace.h.
517         (WTF::StackTrace::StackTrace):
518         (WTF::StackTrace::stack):
519         (WTF::StackTrace::DemangleEntry::mangledName):
520         (WTF::StackTrace::DemangleEntry::demangledName):
521         (WTF::StackTrace::DemangleEntry::DemangleEntry):
522         * wtf/SystemFree.h: Renamed from Source/JavaScriptCore/tools/StackTrace.h.
523         (WTF::SystemFree::operator()):
524
525 2017-04-24  Yusuke Suzuki  <utatane.tea@gmail.com>
526
527         [AppleWin] The procedure entry point ?waitForThreadCompletion@WTF@@YAHI@Z could not be located in the dynamic link library WebKitQuartzCoreAdditions.dll
528         https://bugs.webkit.org/show_bug.cgi?id=171029
529
530         Reviewed by Brent Fulgham.
531
532         While WTF Threading APIs are updated, WebKitQuartzCoreAdditions.dll in Windows uses some of the old APIs,
533         waitForThreadCompletion and createThread. This patch implements both on top of the new APIs.
534         These APIs are only exposed in Windows for this compatibility problem and new code should not use it.
535
536         * wtf/ThreadHolder.cpp:
537         (WTF::ThreadHolder::initialize):
538         * wtf/ThreadHolder.h:
539         * wtf/ThreadHolderWin.cpp:
540         (WTF::ThreadHolder::get):
541         (WTF::ThreadHolder::platformInitialize):
542         (WTF::ThreadHolder::destruct):
543         * wtf/Threading.h:
544         * wtf/ThreadingWin.cpp:
545         (WTF::createThread):
546         (WTF::waitForThreadCompletion):
547
548 2017-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
549
550         [GTK] Switch to use ENABLE_REMOTE_INSPECTOR instead of ENABLE_INSPECTOR_SERVER for the remote inspector
551         https://bugs.webkit.org/show_bug.cgi?id=166680
552
553         Reviewed by Michael Catanzaro.
554
555         Add GRefPtr hash traits to allow using GRefPtr as a key of HashMaps.
556
557         * wtf/glib/GRefPtr.h:
558         (WTF::HashTraits<GRefPtr<P>>::emptyValue):
559         (WTF::HashTraits<GRefPtr<P>>::peek):
560         (WTF::HashTraits<GRefPtr<P>>::customDeleteBucket):
561
562 2017-04-22  Yusuke Suzuki  <utatane.tea@gmail.com>
563
564         [JSC] Get stack pointer without pthread attr
565         https://bugs.webkit.org/show_bug.cgi?id=171162
566
567         Reviewed by Mark Lam.
568
569         If HAVE(MACHINE_CONTEXT) is not enabled, we get stack base and boundary by using
570         pthread_attr functions. However, it is wrong since this function can be called
571         after the thread is suspended. In that case, we should not call any functions
572         that is not async signal safe. For example, pthread_getattr_np calls malloc.
573
574         Instead we use getApproximateStackPointer(), which returns approximate stack pointer.
575
576         * wtf/Threading.h:
577         * wtf/ThreadingPthreads.cpp:
578         (WTF::getApproximateStackPointer):
579         (WTF::isOnAlternativeSignalStack):
580         When gathering conservative roots, we should keep stack pointer pointing stack.
581         And if concurrent GC is enabled, we always need to keep the above invariant.
582         So, we do not support alternative signal stack.
583
584         (WTF::Thread::signalHandlerSuspendResume):
585         (WTF::Thread::getRegisters):
586
587 2017-04-22  Yusuke Suzuki  <utatane.tea@gmail.com>
588
589         REGRESSION(r215638): [Linux] Several worker tests are crashing in Thread::signalHandlerSuspendResume after r215638
590         https://bugs.webkit.org/show_bug.cgi?id=171159
591
592         Reviewed by Michael Catanzaro.
593
594         Now, SIGUSR2 is used by ThreadMessage. Instead SIGUSR1 becomes empty.
595         We should use some signal, that is not managed by WTF Signal mechanism
596         because the behaivor of this suspend and resume is a bit tricky.
597         For example, we set a bit tricky signal mask to sigaction to temporary
598         block SIGUSR2 in the handler to avoid nested SIGUSR2. And we cannot
599         use ThreadMessage to implement this mechanism because this suspend
600         and resume handler will stop in the middle of the handler by sigsuspend.
601         It is not the expected semantics by ThreadMessage.
602
603         So now, we use SIGUSR1 instead. And we note that SIGUSR1 is used for
604         pthread ports.
605
606         * wtf/ThreadingPthreads.cpp:
607         * wtf/threads/Signals.h:
608
609 2017-04-20  Sam Weinig  <sam@webkit.org>
610
611         Split cryptographic digest computation and parsing out of CSP code so it can be reused
612         https://bugs.webkit.org/show_bug.cgi?id=171076
613
614         Reviewed by Chris Dumez.
615
616         * wtf/text/Base64.cpp:
617         (WTF::base64Decode):
618         (WTF::base64URLDecode):
619         Add overloads for base64Decode and base64URLDecode that take a StringView, to avoid allocations
620         of Strings.
621
622         * wtf/text/Base64.h:
623         (WTF::isBase64OrBase64URLCharacter):
624         Move helper predicate used for parsing either type of Base64 encoded string from WebCore.
625
626 2017-04-21  Keith Miller  <keith_miller@apple.com>
627
628         Unreviewed, rolling out r215634.
629
630         underlying build issues should have been fixed
631
632         Reverted changeset:
633
634         "Unreviewed, rolling out r215620 and r215623."
635         https://bugs.webkit.org/show_bug.cgi?id=171139
636         http://trac.webkit.org/changeset/215634
637
638 2017-04-21  Keith Miller  <keith_miller@apple.com>
639
640         Remove LL/SC from Atomics
641         https://bugs.webkit.org/show_bug.cgi?id=171141
642
643         Reviewed by Saam Barati.
644
645         Adding load link and store conditionally was not an actual progression
646         and the existing code is causing problems for users of Atomics. So let's
647         get rid of it.
648
649         * wtf/Atomics.h:
650         (WTF::hasFence):
651         (WTF::Atomic::exchange):
652         (WTF::Atomic::transaction):
653         (WTF::Atomic::transactionRelaxed):
654         (WTF::Atomic::prepare): Deleted.
655         (WTF::Atomic::attempt): Deleted.
656         * wtf/Bitmap.h:
657         (WTF::WordType>::concurrentTestAndSet):
658         (WTF::WordType>::concurrentTestAndClear):
659         * wtf/LockAlgorithm.h:
660         (WTF::LockAlgorithm::lockFast):
661         (WTF::LockAlgorithm::unlockFast):
662
663 2017-04-21  Commit Queue  <commit-queue@webkit.org>
664
665         Unreviewed, rolling out r215620 and r215623.
666         https://bugs.webkit.org/show_bug.cgi?id=171139
667
668         broke arm64 build (Requested by keith_miller on #webkit).
669
670         Reverted changesets:
671
672         "Add signaling API"
673         https://bugs.webkit.org/show_bug.cgi?id=170976
674         http://trac.webkit.org/changeset/215620
675
676         "Unreviewed, fix Cloop build."
677         http://trac.webkit.org/changeset/215623
678
679 2017-04-20  Keith Miller  <keith_miller@apple.com>
680
681         Add signaling API
682         https://bugs.webkit.org/show_bug.cgi?id=170976
683
684         Reviewed by Filip Pizlo.
685
686         This patch adds a bunch of new functionality to WTF. First, it add
687         a new data structure of a lockless bag. The LocklessBag class can
688         be used as either a multi-writer multi-reader lockless bag or a
689         multi-writer single consumer lockless bag.
690
691         Next, this patch adds an abstraction around sigaction in WTF.
692         Basically, you can add a handler, which can be an arbitrary
693         lambda. Although it should still be safe for the signal you are
694         handling.  the signal handler manager will then do all the
695         appropriate handling of chaining:
696
697         In the SIGUSR case we always forward the signal to any other
698         non-default handler installed before us. We need to do this,
699         otherwise, since it's not possible to tell if a SIGUSR was
700         intended exlusively for our handlers. Signal handlers don't record
701         how many times they were sent only that there is at least one
702         unhandled signal.
703
704         In the faulting cases we require that every handle be able to
705         recognise a fault they installed, vs crashes. If none of our
706         handlers claim to have handled the fault we will forward the
707         fault. If a handler was installed before the first fault handler
708         we simply call that handler and rely on them to take the
709         appropriate action. If no handler was installed before our first
710         handler we restore the default handler and allow the fault to
711         happen again.
712
713         Finally, this patch adds a signal based messaging system.  This
714         system allows the user to run an arbitrary lambda from the SIGUSR2
715         signal handler of any target WTF::Thread. This is already in use
716         for the VMTraps API which allows us to kill rogue VMs by sending
717         the VM's running WTF::Thread a SIGUSR and requesting it jetison
718         all optimized code and throw an uncatchable exception from all
719         function entries/loop backedges.  In the future, we will also use
720         this API for Wasm to reset the instruction caches in currently
721         executing Wasm threads.
722
723         * WTF.xcodeproj/project.pbxproj:
724         * wtf/Atomics.h:
725         (WTF::Atomic::Atomic):
726         * wtf/LocklessBag.h: Added.
727         (WTF::LocklessBag::LocklessBag):
728         (WTF::LocklessBag::add):
729         (WTF::LocklessBag::iterate):
730         (WTF::LocklessBag::consumeAll):
731         * wtf/ThreadMessage.cpp: Added.
732         (WTF::ThreadMessageData::ThreadMessageData):
733         (WTF::initializeThreadMessages):
734         (WTF::sendMessageScoped):
735         * wtf/ThreadMessage.h: Added.
736         (WTF::sendMessage):
737         * wtf/Threading.cpp:
738         (WTF::initializeThreading):
739         * wtf/Threading.h:
740         (WTF::Thread::threadMessages):
741         * wtf/ThreadingPthreads.cpp:
742         (WTF::Thread::currentMayBeNull):
743         (WTF::Thread::current):
744         (WTF::Thread::signal):
745         * wtf/threads/Signals.cpp: Added.
746         (WTF::jscSignalHandler):
747         (WTF::installSignalHandler):
748         * wtf/threads/Signals.h: Added.
749         (WTF::toSystemSignal):
750         (WTF::fromSystemSignal):
751
752 2017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
753
754         [cmake] WTF target should not have wtf and subdirectries in public interface
755         https://bugs.webkit.org/show_bug.cgi?id=171115
756
757         Reviewed by Michael Catanzaro.
758
759         In r209665 WEBCORE_FRAMEWORK macro started to export INCLUDE_DIRECTORIES of
760         targets as their public interface, so that linked targets can use them
761         implicitly without copying directory lists around. This matches existing
762         practice for all targets except WTF, headers from which are always included
763         with full path starting from "<wtf/...".
764
765         Since r209665 it became possible to include headers from wtf or its
766         subdirectories in CMake builds without using "<wtf/..." path. It should
767         not be allowed.
768
769         * wtf/CMakeLists.txt: WTF/wtf and its sudirectories should not be in
770         public include paths of WTF target.
771
772 2017-04-20  Sam Weinig  <sam@webkit.org>
773
774         Move notFound into its own file
775         https://bugs.webkit.org/show_bug.cgi?id=170972
776
777         Reviewed by Zalan Bujtas.
778
779         It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
780         This is not causing any current problems, but does in few changes I have
781         queued up.
782
783         * WTF.xcodeproj/project.pbxproj:
784         * wtf/NotFound.h: Added.
785         * wtf/Vector.h:
786         * wtf/text/StringCommon.h:
787
788 2017-04-20  Filip Pizlo  <fpizlo@apple.com>
789
790         Optimize SharedArrayBuffer in the DFG+FTL
791         https://bugs.webkit.org/show_bug.cgi?id=164108
792
793         Reviewed by Saam Barati.
794         
795         Made small changes as part of benchmarking the JS versions of these locks.
796
797         * benchmarks/LockSpeedTest.cpp:
798         * benchmarks/ToyLocks.h:
799         * wtf/Range.h:
800         (WTF::Range::dump):
801
802 2017-04-19  Youenn Fablet  <youenn@apple.com>
803
804         [Win] Activate streams API by default
805         https://bugs.webkit.org/show_bug.cgi?id=171000
806
807         Reviewed by Brent Fulgham.
808
809         * wtf/FeatureDefines.h:
810
811 2017-04-19  David Kilzer  <ddkilzer@apple.com>
812
813         Vector.h: error: 'auto' not allowed in lambda parameter
814         <https://webkit.org/b/171010>
815         <rdar://problem/31716076>
816
817         Reviewed by Saam Barati.
818
819         * wtf/Vector.h:
820         (WTF::removeRepeatedElements): Replace 'auto' with a specific
821         type, 'T', based on a Vector<> template type.
822
823 2017-04-19  Ryan Haddad  <ryanhaddad@apple.com>
824
825         Unreviewed, rolling out r215518.
826
827         This change appears to have broken the Windows build.
828
829         Reverted changeset:
830
831         "Move notFound into its own file"
832         https://bugs.webkit.org/show_bug.cgi?id=170972
833         http://trac.webkit.org/changeset/215518
834
835 2017-04-19  Sam Weinig  <sam@webkit.org>
836
837         Move notFound into its own file
838         https://bugs.webkit.org/show_bug.cgi?id=170972
839
840         Reviewed by Zalan Bujtas.
841
842         It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
843         This is not causing any current problems, but does in few changes I have
844         queued up.
845
846         * WTF.xcodeproj/project.pbxproj:
847         * wtf/NotFound.h: Added.
848         * wtf/Vector.h:
849         * wtf/text/StringCommon.h:
850
851 2017-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
852
853         [GLIB] Define priorities also for async network IO tasks
854         https://bugs.webkit.org/show_bug.cgi?id=170905
855
856         Reviewed by Žan Doberšek.
857
858         Add AsyncIONetwork, DiskCacheRead and DiskCacheWrite priorities.
859
860         * wtf/glib/RunLoopSourcePriority.h:
861
862 2017-04-18  Yusuke Suzuki  <utatane.tea@gmail.com>
863
864         [JSC][GTK] glib RunLoop does not accept negative start interval
865         https://bugs.webkit.org/show_bug.cgi?id=170775
866
867         Reviewed by Saam Barati.
868
869         RunLoop::Timer for glib does not accept negative start interval.
870         We use 0_s if the given value is negative.
871
872         * wtf/glib/RunLoopGLib.cpp:
873         (WTF::RunLoop::TimerBase::secondsUntilFire):
874
875 2017-04-17  Alex Christensen  <achristensen@webkit.org>
876
877         Allow Variants of RetainPtrs
878         https://bugs.webkit.org/show_bug.cgi?id=170923
879
880         Reviewed by Tim Horton and Sam Weinig.
881
882         * wtf/RetainPtr.h:
883         (WTF::RetainPtr::operator&): Deleted.
884         Operator& was causing a compile error when making Variant<RetainPtr<T>, ...>
885         and because it is strange and only used once, let's just remove it.
886         * wtf/Variant.h:
887         (WTF::get):
888         (WTF::get_if):
889         Use std::addressof instead of operator& which could be overloaded to return any type with any meaning.
890
891 2017-04-17  Youenn Fablet  <youenn@apple.com>
892
893         Disable outdated WritableStream API
894         https://bugs.webkit.org/show_bug.cgi?id=170749
895         <rdar://problem/31446233>
896
897         Reviewed by Alex Christensen.
898
899         Replacing READABLE_STREAM_API, READABLE_BYTE_STREAM_API and WRITABLE_STREAM_API compilation flag by:
900         - A STREAMS_API compilation flag.
901         - A ReadableByteStreamAPI and WritableStreamAPI runtime flags, turned off except for RWT and DRT.
902
903         * wtf/FeatureDefines.h:
904
905 2017-04-17  Dan Bernstein  <mitz@apple.com>
906
907         [Cocoa] Move isNullFunctionPointer down into WTF
908         https://bugs.webkit.org/show_bug.cgi?id=170892
909
910         Reviewed by Sam Weinig.
911
912         Test: TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp
913
914         * WTF.xcodeproj/project.pbxproj: Added reference to new file.
915         * wtf/darwin: Added.
916         * wtf/darwin/WeakLinking.h: Added.
917         (WTF::isNullFunctionPointer): Copied from ResourceLoadStatisticsClassifierCocoa.cpp in
918           WebKit2 and changed into a function template that works with any function pointer.
919
920 2017-04-17  Ryan Haddad  <ryanhaddad@apple.com>
921
922         Unreviewed, rolling out r215366.
923
924         This test is failing on performance bots.
925
926         Reverted changeset:
927
928         "Add performance test for asking the platform for a font for
929         U+2060 WORD JOINER"
930         https://bugs.webkit.org/show_bug.cgi?id=170842
931         http://trac.webkit.org/changeset/215366
932
933 2017-04-17  Yusuke Suzuki  <utatane.tea@gmail.com>
934
935         [JSCOnly] Fix build failures in macOS
936         https://bugs.webkit.org/show_bug.cgi?id=170887
937
938         Reviewed by Alex Christensen.
939
940         JSCOnly port does not use mac/MainThread.cpp.
941         We change the ifdef gurard to use generic implementaion in JSCOnly on macOS.
942
943         * wtf/MainThread.cpp:
944         * wtf/PlatformJSCOnly.cmake:
945
946 2017-04-17  JF Bastien  <jfbastien@apple.com>
947
948         B3: don't allow unsigned offsets in Value
949         https://bugs.webkit.org/show_bug.cgi?id=170692
950
951         Reviewed by Filip Pizlo.
952
953         Add C++17's std::conjunction type trait, except for Microsoft VS
954         2015 update 2 and later because it adds the logical operator type
955         traits, event when C++ is pre-2017:
956         https://blogs.msdn.microsoft.com/vcblog/2016/01/22/vs-2015-update-2s-stl-is-c17-so-far-feature-complete/
957
958         * wtf/StdLibExtras.h:
959
960 2017-04-14  Mark Lam  <mark.lam@apple.com>
961
962         Update architectures in xcconfig files.
963         https://bugs.webkit.org/show_bug.cgi?id=170867
964         <rdar://problem/31628104>
965
966         Reviewed by Joseph Pecoraro.
967
968         * Configurations/Base.xcconfig:
969
970 2017-04-14  Myles C. Maxfield  <mmaxfield@apple.com>
971
972         Add performance test for asking the platform for a font for U+2060 WORD JOINER
973         https://bugs.webkit.org/show_bug.cgi?id=170842
974
975         Reviewed by Tim Horton.
976
977         * wtf/unicode/CharacterNames.h:
978
979 2017-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
980
981         [JSC] Date.parse should accept wider range of representation
982         https://bugs.webkit.org/show_bug.cgi?id=170720
983
984         Reviewed by Darin Adler.
985
986         We would like to relax Date.parse to accept the representation "May 8".
987         At that time, we choose `2000` as a default year. This is because of
988         the following reason.
989
990         1. According to the V8, this default value is compatible to the old KJS. While current V8 uses 2001,
991            SpiderMonkey does not have such a fallback path. So this reason is not big deal.
992
993         2. It is a leap year. When using `new Date("Feb 29")`, we assume that people want to save month and day.
994            Leap year can save user inputs if they is valid. If we use the current year instead, the current year
995            may not be a leap year. In that case, `new Date("Feb 29").getMonth()` becomes 2 (March).
996
997         * wtf/DateMath.cpp:
998         (WTF::parseDateFromNullTerminatedCharacters):
999
1000 2017-04-13  Dan Bernstein  <mitz@apple.com>
1001
1002         WTF installs an extra copy of a header outside /usr/local/include/wtf
1003
1004         * WTF.xcodeproj/project.pbxproj: Demoted PriorityQueue.h from Private to Project.
1005
1006 2017-04-13  Oliver Hunt  <oliver@apple.com>
1007
1008         allocationSize should use safe arithmetic by default
1009         https://bugs.webkit.org/show_bug.cgi?id=170804
1010
1011         Reviewed by JF Bastien.
1012
1013         Make all allocationSize() functions work in terms
1014         of Checked<size_t>
1015
1016         * wtf/text/StringImpl.h:
1017         (WTF::StringImpl::allocationSize):
1018         (WTF::StringImpl::tailOffset):
1019
1020 2017-04-13  JF Bastien  <jfbastien@apple.com>
1021
1022         WebAssembly: manage memory better
1023         https://bugs.webkit.org/show_bug.cgi?id=170628
1024
1025         Reviewed by Keith Miller, Michael Saboff.
1026
1027         Re-use a VM tag which was intended for JavaScript core, was then
1028         used by our GC, and is now unused. If I don't do this then
1029         WebAssembly fast memories will make vmmap look super weird because
1030         it'll look like multi-gigabyte of virtual memory are allocated as
1031         part of our process' regular memory!
1032
1033         Separately I need to update vmmap and other tools to print the
1034         right name. Right now this tag gets identified as "JS garbage
1035         collector".
1036
1037         * wtf/OSAllocator.h:
1038         * wtf/VMTags.h:
1039
1040 2017-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
1041
1042         [JSC] Use proper ifdef guard for code using MachineContext
1043         https://bugs.webkit.org/show_bug.cgi?id=170800
1044
1045         Reviewed by Carlos Alberto Lopez Perez.
1046
1047         SamplingProfiler and FastMemory rely on MachineContext feature.
1048
1049         * wtf/Platform.h:
1050
1051 2017-04-12  Dan Bernstein  <mitz@apple.com>
1052
1053         [Mac] Future-proof .xcconfig files
1054         https://bugs.webkit.org/show_bug.cgi?id=170802
1055
1056         Reviewed by Tim Horton.
1057
1058         * Configurations/Base.xcconfig:
1059         * Configurations/DebugRelease.xcconfig:
1060
1061 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1062
1063         Use HAVE(MACHINE_CONTEXT) instead of USE(MACHINE_CONTEXT)
1064         https://bugs.webkit.org/show_bug.cgi?id=170770
1065
1066         Rubber stamped by Mark Lam.
1067
1068         * wtf/Platform.h:
1069         * wtf/PlatformRegisters.h:
1070         * wtf/ThreadingPthreads.cpp:
1071         (WTF::Thread::getRegisters):
1072
1073 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1074
1075         [JSC] Clean up heap/MachineStackMarker by introducing USE(MACHINE_CONTEXT)
1076         https://bugs.webkit.org/show_bug.cgi?id=170770
1077
1078         Reviewed by Mark Lam.
1079
1080         We add a new define USE_MACHINE_CONTEXT, which becomes true if mcontext_t exists
1081         and we know the way to retrieve values from mcontext_t.
1082
1083         * wtf/Platform.h:
1084         * wtf/PlatformRegisters.h:
1085         * wtf/ThreadingPthreads.cpp:
1086         (WTF::Thread::getRegisters):
1087
1088 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1089
1090         [WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading implementation semantics to Pthread one
1091         https://bugs.webkit.org/show_bug.cgi?id=170502
1092
1093         Reviewed by Mark Lam.
1094
1095         This patch is refactoring of WTF Threading mechanism to merge JavaScriptCore's threading extension to WTF Threading.
1096         Previously, JavaScriptCore requires richer threading features (such as suspending and resuming threads), and they
1097         are implemented for PlatformThread in JavaScriptCore. But these features should be implemented in WTF Threading side
1098         instead of maintaining JSC's own threading features too. This patch removes these features from JSC and move it to
1099         WTF Threading.
1100
1101         However, current WTF Threading has one problem: Windows version of WTF Threading has different semantics from Pthreads
1102         one. In Windows WTF Threading, we cannot perform any operation after the target thread is detached: WTF Threading stop
1103         tracking the state of the thread once the thread is detached. But this is not the same to Pthreads one. In Pthreads,
1104         pthread_detach just means that the resource of the thread will be destroyed automatically. While some operations like
1105         pthread_join will be rejected, some operations like pthread_kill will be accepted.
1106
1107         The problem is that detached thread can be suspended and resumed in JSC. For example, in jsc.cpp, we start the worker
1108         thread and detach it immediately. In worker thread, we will create VM and thus concurrent GC will suspend and resume
1109         the detached thread. However, in Windows WTF Threading, we have no reference to the detached thread. Thus we cannot
1110         perform suspend and resume operations onto the detached thread.
1111
1112         To solve the problem, we change Windows Threading mechanism drastically to align it to the Pthread semantics. In the
1113         new Threading, we have RefPtr<Thread> class. It holds a handle to a platform thread. We can perform threading operations
1114         with this class. For example, Thread::suspend is offered. And we use destructor of the thread local variable to release
1115         the resources held by RefPtr<Thread>. In Windows, Thread::detach does nothing because the resource will be destroyed
1116         automatically by RefPtr<Thread>.
1117
1118         To do so, we introduce ThreadHolder for Windows. This is similar to the previous ThreadIdentifierData for Pthreads.
1119         It holds RefPtr<Thread> in the thread local storage (technically, it is Fiber Local Storage in Windows). Thread::current()
1120         will return this reference.
1121
1122         The problematic situation is that the order of the deallocation of the thread local storage is not defined. So we should
1123         not touch thread local storage in the destructor of the thread local storage. To avoid such edge cases, we have
1124         currentThread() / Thread::currentID() APIs. They are safe to be called even in the destructor of the other thread local
1125         storage. And in Windows, in the FLS destructor, we will create the thread_local variable to defer the destruction of
1126         the ThreadHolder. We ensure that this destructor is called after the other FLS destructors are called in Windows 10.
1127
1128         This patch is performance neutral.
1129
1130         * WTF.xcodeproj/project.pbxproj:
1131         * benchmarks/ConditionSpeedTest.cpp:
1132         * benchmarks/LockFairnessTest.cpp:
1133         * benchmarks/LockSpeedTest.cpp:
1134         * wtf/AutomaticThread.cpp:
1135         (WTF::AutomaticThread::start):
1136         * wtf/CMakeLists.txt:
1137         * wtf/MainThread.h:
1138         * wtf/MemoryPressureHandler.h:
1139         * wtf/ParallelJobsGeneric.cpp:
1140         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
1141         (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
1142         * wtf/ParallelJobsGeneric.h:
1143         (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): Deleted.
1144         * wtf/ParkingLot.cpp:
1145         (WTF::ParkingLot::forEachImpl):
1146         * wtf/ParkingLot.h:
1147         (WTF::ParkingLot::forEach):
1148         * wtf/PlatformRegisters.h: Renamed from Source/JavaScriptCore/runtime/PlatformThread.h.
1149         * wtf/RefPtr.h:
1150         (WTF::RefPtr::RefPtr):
1151         * wtf/ThreadFunctionInvocation.h:
1152         (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation):
1153         * wtf/ThreadHolder.cpp: Added.
1154         (WTF::ThreadHolder::~ThreadHolder):
1155         (WTF::ThreadHolder::initialize):
1156         * wtf/ThreadHolder.h: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.h.
1157         (WTF::ThreadHolder::thread):
1158         (WTF::ThreadHolder::ThreadHolder):
1159         * wtf/ThreadHolderPthreads.cpp: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp.
1160         (WTF::ThreadHolder::initializeOnce):
1161         (WTF::ThreadHolder::current):
1162         (WTF::ThreadHolder::destruct):
1163         * wtf/ThreadHolderWin.cpp: Added.
1164         (WTF::threadMapMutex):
1165         (WTF::threadMap):
1166         (WTF::ThreadHolder::initializeOnce):
1167         (WTF::ThreadHolder::current):
1168         (WTF::ThreadHolder::destruct):
1169         * wtf/ThreadSpecific.h:
1170         * wtf/Threading.cpp:
1171         (WTF::Thread::normalizeThreadName):
1172         (WTF::threadEntryPoint):
1173         (WTF::Thread::create):
1174         (WTF::Thread::setCurrentThreadIsUserInteractive):
1175         (WTF::Thread::setCurrentThreadIsUserInitiated):
1176         (WTF::Thread::setGlobalMaxQOSClass):
1177         (WTF::Thread::adjustedQOSClass):
1178         (WTF::Thread::dump):
1179         (WTF::initializeThreading):
1180         (WTF::normalizeThreadName): Deleted.
1181         (WTF::createThread): Deleted.
1182         (WTF::setCurrentThreadIsUserInteractive): Deleted.
1183         (WTF::setCurrentThreadIsUserInitiated): Deleted.
1184         (WTF::setGlobalMaxQOSClass): Deleted.
1185         (WTF::adjustedQOSClass): Deleted.
1186         * wtf/Threading.h:
1187         (WTF::Thread::id):
1188         (WTF::Thread::operator==):
1189         (WTF::Thread::operator!=):
1190         (WTF::Thread::joinableState):
1191         (WTF::Thread::didBecomeDetached):
1192         (WTF::Thread::didJoin):
1193         (WTF::Thread::hasExited):
1194         (WTF::currentThread):
1195         * wtf/ThreadingPthreads.cpp:
1196         (WTF::Thread::Thread):
1197         (WTF::Thread::~Thread):
1198         (WTF::Thread::signalHandlerSuspendResume):
1199         (WTF::Thread::initializePlatformThreading):
1200         (WTF::initializeCurrentThreadEvenIfNonWTFCreated):
1201         (WTF::wtfThreadEntryPoint):
1202         (WTF::Thread::createInternal):
1203         (WTF::Thread::initializeCurrentThreadInternal):
1204         (WTF::Thread::changePriority):
1205         (WTF::Thread::waitForCompletion):
1206         (WTF::Thread::detach):
1207         (WTF::Thread::current):
1208         (WTF::Thread::currentID):
1209         (WTF::Thread::signal):
1210         (WTF::Thread::resume):
1211         (WTF::Thread::getRegisters):
1212         (WTF::Thread::didExit):
1213         (WTF::Thread::establish):
1214         (WTF::PthreadState::PthreadState): Deleted.
1215         (WTF::PthreadState::joinableState): Deleted.
1216         (WTF::PthreadState::pthreadHandle): Deleted.
1217         (WTF::PthreadState::didBecomeDetached): Deleted.
1218         (WTF::PthreadState::didExit): Deleted.
1219         (WTF::PthreadState::didJoin): Deleted.
1220         (WTF::PthreadState::hasExited): Deleted.
1221         (WTF::threadMapMutex): Deleted.
1222         (WTF::initializeThreading): Deleted.
1223         (WTF::threadMap): Deleted.
1224         (WTF::identifierByPthreadHandle): Deleted.
1225         (WTF::establishIdentifierForPthreadHandle): Deleted.
1226         (WTF::pthreadHandleForIdentifierWithLockAlreadyHeld): Deleted.
1227         (WTF::createThreadInternal): Deleted.
1228         (WTF::initializeCurrentThreadInternal): Deleted.
1229         (WTF::changeThreadPriority): Deleted.
1230         (WTF::waitForThreadCompletion): Deleted.
1231         (WTF::detachThread): Deleted.
1232         (WTF::threadDidExit): Deleted.
1233         (WTF::currentThread): Deleted.
1234         (WTF::signalThread): Deleted.
1235         * wtf/ThreadingWin.cpp:
1236         (WTF::Thread::Thread):
1237         (WTF::Thread::~Thread):
1238         (WTF::Thread::initializeCurrentThreadInternal):
1239         (WTF::Thread::initializePlatformThreading):
1240         (WTF::wtfThreadEntryPoint):
1241         (WTF::Thread::createInternal):
1242         (WTF::Thread::changePriority):
1243         (WTF::Thread::waitForCompletion):
1244         (WTF::Thread::detach):
1245         (WTF::Thread::resume):
1246         (WTF::Thread::getRegisters):
1247         (WTF::Thread::current):
1248         (WTF::Thread::currentID):
1249         (WTF::Thread::didExit):
1250         (WTF::Thread::establish):
1251         (WTF::initializeCurrentThreadInternal): Deleted.
1252         (WTF::threadMapMutex): Deleted.
1253         (WTF::initializeThreading): Deleted.
1254         (WTF::threadMap): Deleted.
1255         (WTF::storeThreadHandleByIdentifier): Deleted.
1256         (WTF::threadHandleForIdentifier): Deleted.
1257         (WTF::clearThreadHandleForIdentifier): Deleted.
1258         (WTF::createThreadInternal): Deleted.
1259         (WTF::changeThreadPriority): Deleted.
1260         (WTF::waitForThreadCompletion): Deleted.
1261         (WTF::detachThread): Deleted.
1262         (WTF::currentThread): Deleted.
1263         * wtf/WorkQueue.cpp:
1264         (WTF::WorkQueue::concurrentApply):
1265         * wtf/WorkQueue.h:
1266         * wtf/cocoa/WorkQueueCocoa.cpp:
1267         (WTF::dispatchQOSClass):
1268         * wtf/generic/WorkQueueGeneric.cpp:
1269         (WorkQueue::platformInitialize):
1270         (WorkQueue::platformInvalidate):
1271         * wtf/linux/MemoryPressureHandlerLinux.cpp:
1272         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
1273         (WTF::MemoryPressureHandler::EventFDPoller::~EventFDPoller):
1274         * wtf/win/MainThreadWin.cpp:
1275         (WTF::initializeMainThreadPlatform):
1276
1277 2017-04-11  Zan Dobersek  <zdobersek@igalia.com>
1278
1279         [GTK] Use the DisplayRefreshMonitor facilities
1280         https://bugs.webkit.org/show_bug.cgi?id=170599
1281
1282         Reviewed by Carlos Garcia Campos.
1283
1284         * wtf/Platform.h: Enable USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR for the GTK+ port.
1285         * wtf/glib/RunLoopSourcePriority.h: Add the DisplayRefreshMonitorTimer entry that
1286         matches the value of LayerFlushTimer.
1287
1288 2017-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1289
1290         [WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
1291         https://bugs.webkit.org/show_bug.cgi?id=170725
1292
1293         Reviewed by Sam Weinig.
1294
1295         Make MonotonicTime more constexpr friendly mainly to annotate MonotonicTime::nan() as constexpr.
1296
1297         * wtf/MonotonicTime.h:
1298         (WTF::MonotonicTime::MonotonicTime):
1299         (WTF::MonotonicTime::fromRawSeconds):
1300         (WTF::MonotonicTime::infinity):
1301         (WTF::MonotonicTime::nan):
1302         (WTF::MonotonicTime::secondsSinceEpoch):
1303         (WTF::MonotonicTime::operator bool):
1304         (WTF::MonotonicTime::operator+):
1305         (WTF::MonotonicTime::operator-):
1306         (WTF::MonotonicTime::operator==):
1307         (WTF::MonotonicTime::operator!=):
1308         (WTF::MonotonicTime::operator<):
1309         (WTF::MonotonicTime::operator>):
1310         (WTF::MonotonicTime::operator<=):
1311         (WTF::MonotonicTime::operator>=):
1312
1313 2017-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1314
1315         Unreviewed, build fix for Windows port after r215228
1316         https://bugs.webkit.org/show_bug.cgi?id=170723
1317
1318         * wtf/win/RunLoopWin.cpp:
1319         (WTF::RunLoop::TimerBase::timerFired):
1320
1321 2017-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1322
1323         [JSC][GTK] Use RunLoop::Timer in GTK port
1324         https://bugs.webkit.org/show_bug.cgi?id=170723
1325
1326         Reviewed by Carlos Garcia Campos.
1327
1328         Add secondsUntilFire method. And add setName and setPriority
1329         for GTK RunLoop::Timer.
1330
1331         * wtf/RunLoop.h:
1332         * wtf/cf/RunLoopCF.cpp:
1333         (WTF::RunLoop::TimerBase::secondsUntilFire):
1334         * wtf/generic/RunLoopGeneric.cpp:
1335         (WTF::RunLoop::TimerBase::secondsUntilFire):
1336         * wtf/glib/RunLoopGLib.cpp:
1337         (WTF::RunLoop::TimerBase::setName):
1338         (WTF::RunLoop::TimerBase::secondsUntilFire):
1339         * wtf/win/RunLoopWin.cpp:
1340         (WTF::RunLoop::TimerBase::timerFired):
1341         (WTF::RunLoop::TimerBase::start):
1342         (WTF::RunLoop::TimerBase::isActive):
1343         (WTF::RunLoop::TimerBase::secondsUntilFire):
1344
1345 2017-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1346
1347         [JSC] Enable JSRunLoopTimer for JSCOnly and Windows
1348         https://bugs.webkit.org/show_bug.cgi?id=170655
1349
1350         Reviewed by Carlos Garcia Campos.
1351
1352         This patch makes RunLoop::Timer in Generic and Windows thread-safe to use it
1353         in JSC's JSRunLoopTimer. Eventually, we would like to replace JSRunLoopTimer's
1354         platform-dependent implementation to WTF::RunLoop::Timer.
1355
1356         * wtf/RunLoop.h:
1357         * wtf/cf/RunLoopCF.cpp:
1358         (WTF::RunLoop::TimerBase::start):
1359         * wtf/generic/RunLoopGeneric.cpp:
1360         (WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
1361         (WTF::RunLoop::populateTasks):
1362         (WTF::RunLoop::runImpl):
1363         (WTF::RunLoop::schedule):
1364         (WTF::RunLoop::scheduleAndWakeUp):
1365         (WTF::RunLoop::TimerBase::~TimerBase):
1366         (WTF::RunLoop::TimerBase::start):
1367         (WTF::RunLoop::TimerBase::stop):
1368         (WTF::RunLoop::TimerBase::isActive):
1369         * wtf/glib/RunLoopGLib.cpp:
1370         (WTF::RunLoop::TimerBase::TimerBase):
1371         * wtf/win/RunLoopWin.cpp:
1372         (WTF::RunLoop::TimerBase::timerFired):
1373         (WTF::RunLoop::TimerBase::start):
1374         (WTF::RunLoop::TimerBase::stop):
1375         (WTF::RunLoop::TimerBase::isActive):
1376
1377 2017-04-11  Zan Dobersek  <zdobersek@igalia.com>
1378
1379         REGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
1380         https://bugs.webkit.org/show_bug.cgi?id=169510
1381
1382         Reviewed by Saam Barati.
1383
1384         Add the `volatile` qualifiers for ASM statements that set up ldxr and stxr
1385         instruction calls when HAVE(LL_SC) is enabled for aarch64 platforms.
1386
1387         This avoids indefinite execution when running GCC-compiled JSC on Linux.
1388         Specific bug or expected behavior that differs from Clang wasn't determined.
1389
1390         HAVE(LL_SC) is re-enabled on non-Darwin aarch64 platforms.
1391
1392         * wtf/Atomics.h:
1393         * wtf/Platform.h:
1394
1395 2017-04-10  Thorsten Glaser  <tg@mirbsd.de>
1396
1397         [GTK] Fix x32 build
1398         https://bugs.webkit.org/show_bug.cgi?id=170673
1399
1400         Reviewed by Carlos Alberto Lopez Perez.
1401
1402         * wtf/Platform.h:
1403
1404 2017-04-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1405
1406         [WTF] Annotate Seconds' member functions and operators with constexpr
1407         https://bugs.webkit.org/show_bug.cgi?id=170662
1408
1409         Reviewed by Daniel Bates.
1410
1411         Annotate Seconds' member functions and operators with constexpr.
1412         It allows us to use Seconds calculation in compile time and use these
1413         calculation for static const global variables.
1414
1415         operator% is an exception: it uses fmod and it is not offered as constexpr.
1416
1417         * wtf/MathExtras.h:
1418         (defaultMinimumForClamp):
1419         (defaultMaximumForClamp):
1420         (clampToAccepting64):
1421         Super unfortunate ugly code. This is because GCC 4.9 does not support C++14 relaxed constexpr.
1422
1423         * wtf/Seconds.h:
1424         (WTF::Seconds::Seconds):
1425         (WTF::Seconds::value):
1426         (WTF::Seconds::minutes):
1427         (WTF::Seconds::seconds):
1428         (WTF::Seconds::milliseconds):
1429         (WTF::Seconds::microseconds):
1430         (WTF::Seconds::nanoseconds):
1431         (WTF::Seconds::operator bool):
1432         (WTF::Seconds::operator+):
1433         (WTF::Seconds::operator-):
1434         (WTF::Seconds::operator*):
1435         (WTF::Seconds::operator/):
1436         (WTF::Seconds::operator==):
1437         (WTF::Seconds::operator!=):
1438         (WTF::Seconds::operator<):
1439         (WTF::Seconds::operator>):
1440         (WTF::Seconds::operator<=):
1441         (WTF::Seconds::operator>=):
1442
1443 2017-04-09  Chris Dumez  <cdumez@apple.com>
1444
1445         Start dropping Timer API dealing with double
1446         https://bugs.webkit.org/show_bug.cgi?id=170649
1447
1448         Reviewed by Yusuke Suzuki.
1449
1450         Start dropping Timer API dealing with double as people should use Seconds now.
1451
1452         * wtf/RunLoopTimer.h:
1453         * wtf/glib/MainThreadGLib.cpp:
1454         (WTF::MainThreadDispatcher::schedule):
1455
1456 2017-04-07  Keith Miller  <keith_miller@apple.com>
1457
1458         Unreviewed, remove constexpr function since GTK didn't like it.
1459
1460         * wtf/PriorityQueue.h:
1461         (WTF::PriorityQueue::parentOf):
1462
1463 2017-04-07  Chris Dumez  <cdumez@apple.com>
1464
1465         Start using MonotonicTime / Seconds in Timer class
1466         https://bugs.webkit.org/show_bug.cgi?id=170625
1467
1468         Reviewed by Simon Fraser.
1469
1470         Add modulo operator to MonotonicTime.
1471
1472         * wtf/MonotonicTime.h:
1473         (WTF::MonotonicTime::operator%):
1474
1475 2017-04-07  Keith Miller  <keith_miller@apple.com>
1476
1477         Add a PriorityQueue class
1478         https://bugs.webkit.org/show_bug.cgi?id=170579
1479
1480         Reviewed by Saam Barati.
1481
1482         This patch adds a new PriorityQueue class that is backed by
1483         WTF::Vector.  It also has a number of other niceties such as being
1484         able to iterate the queue and increase or decrease keys.
1485
1486         One note is that increaseKey and decreaseKey are O(n) rather than
1487         O(log(n)).  Traditionally, the lookup of the key is done with a
1488         hash map but that's not feasible here.  This is because unless the
1489         queue's element type is a pointer there is no good way maintain a
1490         persistent reference to every entry in the queue while we sift.
1491         The only way to update the location of an entry is to do a hash
1492         table lookup with the entry's hash but this is probably more
1493         expensive than just doing a linear search.
1494
1495         Also, add comparison operator functions, which can be passed to PriorityQueue.
1496
1497         * WTF.xcodeproj/project.pbxproj:
1498         * wtf/MathExtras.h:
1499         (isLessThan):
1500         (isLessThanEqual):
1501         (isGreaterThan):
1502         (isGreaterThanEqual):
1503         * wtf/PriorityQueue.h: Added.
1504         (WTF::PriorityQueue::size):
1505         (WTF::PriorityQueue::isEmpty):
1506         (WTF::PriorityQueue::enqueue):
1507         (WTF::PriorityQueue::peek):
1508         (WTF::PriorityQueue::dequeue):
1509         (WTF::PriorityQueue::decreaseKey):
1510         (WTF::PriorityQueue::increaseKey):
1511         (WTF::PriorityQueue::begin):
1512         (WTF::PriorityQueue::end):
1513         (WTF::PriorityQueue::isValidHeap):
1514         (WTF::PriorityQueue::parentOf):
1515         (WTF::PriorityQueue::leftChildOf):
1516         (WTF::PriorityQueue::rightChildOf):
1517         (WTF::PriorityQueue::siftUp):
1518         (WTF::PriorityQueue::siftDown):
1519
1520 2017-04-07  Alex Christensen  <achristensen@webkit.org>
1521
1522         Use audit_token_t instead of pid_t for checking sandbox of other processes
1523         https://bugs.webkit.org/show_bug.cgi?id=170616
1524         <rdar://problem/31158189>
1525
1526         Reviewed by Daniel Bates.
1527
1528         * wtf/spi/darwin/SandboxSPI.h:
1529         Declare more SPI.
1530
1531 2017-04-07  Ting-Wei Lan  <lantw44@gmail.com>
1532
1533         Include cstdio before using sscanf and stderr
1534         https://bugs.webkit.org/show_bug.cgi?id=170098
1535
1536         Reviewed by Michael Catanzaro.
1537
1538         * wtf/NumberOfCores.cpp:
1539
1540 2017-04-07  Saam Barati  <sbarati@apple.com>
1541
1542         WebAssembly: Make to a compilation API that allows for multi-VM concurrent compilations of Wasm Modules
1543         https://bugs.webkit.org/show_bug.cgi?id=170488
1544
1545         Reviewed by JF Bastien.
1546
1547         * wtf/SharedTask.h: Make SharedTaskFunctor forward its arguments.
1548
1549 2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1550
1551         [GTK] Update the priorities used in glib main loop sources
1552         https://bugs.webkit.org/show_bug.cgi?id=170457
1553
1554         Reviewed by Žan Doberšek.
1555
1556         Add an enum to define prirorities used in different GLib main sources. It allows to give them a better name
1557         than high, low, medium, etc., but also to document them and other GLib based ports can define their own
1558         values without changing all the places where they are used. The default values are based on the priorities
1559         pre-defined by GLib.
1560
1561         * wtf/glib/MainThreadGLib.cpp:
1562         (WTF::MainThreadDispatcher::MainThreadDispatcher):
1563         * wtf/glib/RunLoopGLib.cpp:
1564         (WTF::RunLoop::RunLoop):
1565         (WTF::RunLoop::dispatchAfter):
1566         (WTF::RunLoop::TimerBase::TimerBase):
1567         * wtf/glib/RunLoopSourcePriority.h: Added.
1568         * wtf/linux/MemoryPressureHandlerLinux.cpp:
1569         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
1570
1571 2017-04-06  Filip Pizlo  <fpizlo@apple.com>
1572
1573         Linear scan should run liveness only once
1574         https://bugs.webkit.org/show_bug.cgi?id=170569
1575
1576         Reviewed by Keith Miller.
1577         
1578         Have Liveness<> call Adapter::prepareToCompute(), since this makes it a lot easier to implement
1579         constraint generation, since the constraint generator now gets to run after the Adapter is fully
1580         constructed.
1581         
1582         * wtf/IndexMap.h:
1583         (WTF::IndexMap::append): Also make this a bit more versatile.
1584         * wtf/Liveness.h:
1585         (WTF::Liveness::LocalCalc::Iterable::contains):
1586         (WTF::Liveness::Iterable::contains):
1587         (WTF::Liveness::compute):
1588
1589 2017-04-06  Andreas Kling  <akling@apple.com>
1590
1591         Kill any WebContent process using over 16 GB of memory.
1592         https://bugs.webkit.org/show_bug.cgi?id=170515
1593         <rdar://problem/29930931>
1594
1595         Reviewed by Antti Koivisto.
1596
1597         Restructure the code since it was getting out of sync with the intended behavior.
1598         Now there's a thresholdForMemoryKill() which returns the current memory limit based
1599         on the process status.
1600
1601         The memory usage policy is separated from the killing, and now only drives the
1602         asynchronous invocations of pressure relief that occur when we pass over one of
1603         the policy edges (now 1GB for Conservative, 2GB for Strict.)
1604
1605         Removed the "Panic" policy and moved the memory kill logic to shrinkOrDie().
1606
1607         Behavior as of this patch:
1608
1609             - Everyone gets killed over 16 GB.
1610             - Inactive processes get killed over 4 GB.
1611             - Strict memory usage policy kicks in at 2 GB.
1612             - Conservative memory usage policy at 1 GB.
1613
1614         Like before, we make a best-effort attempt to free up memory before killing the process.
1615
1616         * wtf/MemoryPressureHandler.cpp:
1617         (WTF::toString):
1618         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
1619         (WTF::thresholdForPolicy):
1620         (WTF::policyForFootprint):
1621         (WTF::MemoryPressureHandler::shrinkOrDie):
1622         (WTF::MemoryPressureHandler::setMemoryUsagePolicyBasedOnFootprint):
1623         (WTF::MemoryPressureHandler::measurementTimerFired):
1624         * wtf/MemoryPressureHandler.h:
1625
1626 2017-04-05  Andreas Kling  <akling@apple.com>
1627
1628         Make inactive web processes behave as though under memory pressure.
1629         https://bugs.webkit.org/show_bug.cgi?id=170042
1630         <rdar://problem/31038445>
1631
1632         Reviewed by Antti Koivisto.
1633
1634         Once a web process becomes inactive, let's try to reduce its impact
1635         on memory usage by treating it as if it's under memory pressure until
1636         it becomes active.
1637
1638         * wtf/MemoryPressureHandler.cpp:
1639         (WTF::MemoryPressureHandler::setProcessState):
1640         (WTF::MemoryPressureHandler::isUnderMemoryPressure):
1641         * wtf/MemoryPressureHandler.h:
1642         (WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
1643
1644 2017-04-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1645
1646         [JSC] Suppress warnings in GCC
1647         https://bugs.webkit.org/show_bug.cgi?id=170501
1648
1649         Reviewed by Keith Miller.
1650
1651         Add a new macro UNUSED_FUNCTION to annotate unused static functions.
1652         #pragma GCC diagnostic ignored "-Wunused-function" does not work.
1653
1654         * wtf/Compiler.h:
1655
1656 2017-04-04  Filip Pizlo  <fpizlo@apple.com>
1657
1658         Air::eliminateDeadCode() should not use a HashSet
1659         https://bugs.webkit.org/show_bug.cgi?id=170487
1660
1661         Reviewed by Saam Barati.
1662         
1663         BitVector::iterator knows when it's at the end. Expose this functionality.
1664
1665         * wtf/BitVector.h:
1666         (WTF::BitVector::iterator::isAtEnd):
1667
1668 2017-04-04  Keith Miller  <keith_miller@apple.com>
1669
1670         WebAssembly: ModuleInformation should be a ref counted thing that can be shared across threads.
1671         https://bugs.webkit.org/show_bug.cgi?id=170478
1672
1673         Reviewed by Saam Barati.
1674
1675         This adds a new String::fromUTF8 that converts a vector of characters to
1676         a string.
1677
1678         Also, it cleans up some style.
1679
1680         * wtf/text/WTFString.h:
1681         (WTF::String::fromUTF8):
1682         * wtf/unicode/UTF8.cpp:
1683         (WTF::Unicode::convertLatin1ToUTF8):
1684
1685 2017-04-04  Filip Pizlo  <fpizlo@apple.com>
1686
1687         B3::fixSSA() needs a tune-up
1688         https://bugs.webkit.org/show_bug.cgi?id=170485
1689
1690         Reviewed by Saam Barati.
1691         
1692         This makes IndexSparseSet capable of being used as a map if you instantiate it with
1693         KeyValuePair<unsigned, ValueType>.
1694
1695         * wtf/HashTraits.h:
1696         * wtf/IndexSparseSet.h:
1697         (WTF::DefaultIndexSparseSetTraits::create):
1698         (WTF::DefaultIndexSparseSetTraits::key):
1699         (WTF::OverflowHandler>::IndexSparseSet):
1700         (WTF::OverflowHandler>::add):
1701         (WTF::OverflowHandler>::set):
1702         (WTF::OverflowHandler>::remove):
1703         (WTF::OverflowHandler>::clear):
1704         (WTF::OverflowHandler>::size):
1705         (WTF::OverflowHandler>::isEmpty):
1706         (WTF::OverflowHandler>::contains):
1707         (WTF::OverflowHandler>::sort):
1708         (WTF::IndexSparseSet<OverflowHandler>::IndexSparseSet): Deleted.
1709         (WTF::IndexSparseSet<OverflowHandler>::add): Deleted.
1710         (WTF::IndexSparseSet<OverflowHandler>::remove): Deleted.
1711         (WTF::IndexSparseSet<OverflowHandler>::clear): Deleted.
1712         (WTF::IndexSparseSet<OverflowHandler>::size): Deleted.
1713         (WTF::IndexSparseSet<OverflowHandler>::isEmpty): Deleted.
1714         (WTF::IndexSparseSet<OverflowHandler>::contains): Deleted.
1715         (WTF::IndexSparseSet<OverflowHandler>::sort): Deleted.
1716         * wtf/Liveness.h:
1717         (WTF::Liveness::LocalCalc::Iterable::iterator::iterator):
1718         (WTF::Liveness::workset):
1719
1720 2017-04-04  Filip Pizlo  <fpizlo@apple.com>
1721
1722         Don't need to Air::reportUsedRegisters for wasm at -O1
1723         https://bugs.webkit.org/show_bug.cgi?id=170459
1724
1725         Reviewed by Saam Barati.
1726         
1727         Just moved the liveness computation into a method, which enabled me to do the profiling
1728         that I used to write this patch.
1729
1730         * wtf/Liveness.h:
1731         (WTF::Liveness::Liveness):
1732         (WTF::Liveness::compute):
1733
1734 2017-04-03  Filip Pizlo  <fpizlo@apple.com>
1735
1736         Air liveness should build constraints and solve them rather than repeatedly parsing IR
1737         https://bugs.webkit.org/show_bug.cgi?id=170421
1738
1739         Reviewed by Saam Barati.
1740
1741         * wtf/Vector.h:
1742         (WTF::minCapacity>::appendIfNotContains): Because sometimes Vector<> is the best kind of set.
1743
1744 2017-04-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1745
1746         [WTF] Introduce WTF::RandomDevice which keeps /dev/urandom opened
1747         https://bugs.webkit.org/show_bug.cgi?id=170095
1748
1749         Reviewed by Michael Catanzaro.
1750
1751         In this patch, we introduce RandomDevice, which keeps /dev/urandom opened
1752         to avoid repeatedly open and close urandom file descriptor in Linux.
1753
1754         The purpose is similar to std::random_device, but WTF::RandomDevice explicitly
1755         avoids using ARC4, which is recently attempted to be removed from the WebKit
1756         tree[1].
1757
1758         [1]: https://trac.webkit.org/r214329
1759
1760         * WTF.xcodeproj/project.pbxproj:
1761         * wtf/CMakeLists.txt:
1762         * wtf/OSRandomSource.cpp:
1763         (WTF::cryptographicallyRandomValuesFromOS):
1764         (WTF::crashUnableToOpenURandom): Deleted.
1765         (WTF::crashUnableToReadFromURandom): Deleted.
1766         * wtf/RandomDevice.cpp: Copied from Source/WTF/wtf/OSRandomSource.cpp.
1767         (WTF::crashUnableToOpenURandom):
1768         (WTF::crashUnableToReadFromURandom):
1769         (WTF::RandomDevice::RandomDevice):
1770         (WTF::RandomDevice::~RandomDevice):
1771         (WTF::RandomDevice::cryptographicallyRandomValues):
1772         * wtf/RandomDevice.h: Added.
1773
1774 2017-04-03  Filip Pizlo  <fpizlo@apple.com>
1775
1776         WTF::Liveness should have an API that focuses on actions at instruction boundaries
1777         https://bugs.webkit.org/show_bug.cgi?id=170407
1778
1779         Reviewed by Keith Miller.
1780         
1781         Change the Liveness<> API to handle early and late things in one lump inside forEachUse
1782         and forEachDef functions. This reduces the amount of different functions that Liveness<>
1783         expects from its adaptor. This makes it easier to implement optimizations that cache the
1784         use/def behavior of each instruction boundary.
1785
1786         * wtf/Liveness.h:
1787         (WTF::Liveness::Liveness):
1788         (WTF::Liveness::LocalCalc::execute):
1789
1790 2017-04-01  Csaba Osztrogonác  <ossy@webkit.org>
1791
1792         Mac cmake buildfix after 214586.
1793         https://bugs.webkit.org/show_bug.cgi?id=170381
1794
1795         Unreviewed.
1796
1797         * wtf/BlockPtr.h:
1798
1799 2017-03-30  Filip Pizlo  <fpizlo@apple.com>
1800
1801         Air should support linear scan for optLevel<2
1802         https://bugs.webkit.org/show_bug.cgi?id=170161
1803
1804         Reviewed by Saam Barati.
1805         
1806         This change introduces a new low-latency register allocator. It can allocate registers very
1807         quickly by doing a relatively poor job. Implementing this algorithm required beefing up some of
1808         our core algorithms.
1809
1810         * WTF.xcodeproj/project.pbxproj:
1811         * wtf/CMakeLists.txt:
1812         * wtf/Deque.h: Make it possible to do some basic priority queueing with this data structure.
1813         (WTF::inlineCapacity>::removeAllMatching):
1814         (WTF::inlineCapacity>::appendAndBubble):
1815         (WTF::inlineCapacity>::takeLast):
1816         * wtf/IndexKeyType.h: Added. This makes it possible to use IndexMap and IndexSet with value or pointer types. Previously they just worked with pointer types.
1817         (WTF::IndexKeyType::index):
1818         * wtf/IndexMap.h: Adopt IndexKeyType.
1819         (WTF::IndexMap::operator[]):
1820         (WTF::IndexMap::append):
1821         * wtf/IndexSet.h: Adopt IndexKeyType.
1822         (WTF::IndexSet::add):
1823         (WTF::IndexSet::addAll):
1824         (WTF::IndexSet::remove):
1825         (WTF::IndexSet::contains):
1826         (WTF::IndexSet::Iterable::iterator::operator*):
1827         * wtf/Range.h: Added. This used to be B3::HeapRange. This generalizes that data structure to any kind of range stuff.
1828         (WTF::Range::Range):
1829         (WTF::Range::top):
1830         (WTF::Range::operator==):
1831         (WTF::Range::operator!=):
1832         (WTF::Range::operator bool):
1833         (WTF::Range::operator|):
1834         (WTF::Range::operator|=):
1835         (WTF::Range::begin):
1836         (WTF::Range::end):
1837         (WTF::Range::overlaps):
1838         (WTF::Range::dump):
1839         * wtf/RangeSet.h:
1840         (WTF::RangeSet::add):
1841
1842 2017-03-25  Yusuke Suzuki  <utatane.tea@gmail.com>
1843
1844         [JSC] Move platformThreadSignal to WTF
1845         https://bugs.webkit.org/show_bug.cgi?id=170097
1846
1847         Reviewed by Mark Lam.
1848
1849         * wtf/Threading.h:
1850         * wtf/ThreadingPthreads.cpp:
1851         (WTF::signalThread):
1852
1853 2017-03-26  Filip Pizlo  <fpizlo@apple.com>
1854
1855         B3::fixSSA should do liveness pruning
1856         https://bugs.webkit.org/show_bug.cgi?id=170111
1857
1858         Reviewed by Saam Barati.
1859         
1860         Move Air::Liveness<> to WTF::Liveness<>. This is pretty easy since Air::Liveness<> was
1861         already fairly generic. It leverages the CFG concept so that it can understand many
1862         different kinds of basic blocks. It doesn't try to understand the contents of basic
1863         blocks; it just asks the adaptor for the block size and asks for the early/late
1864         uses/defs of each thing in the block.
1865         
1866         This makes it easy to create a B3::VariableLiveness, which fixSSA then uses for
1867         pruning. One of the new features is the Liveness::LiveAtHead nested class, which you
1868         instantiate if you want to perform liveAtHead queries, which SSA construction wants to
1869         do.
1870         
1871         This also fixes https://bugs.webkit.org/show_bug.cgi?id=170102#c12
1872
1873         * WTF.xcodeproj/project.pbxproj:
1874         * wtf/CMakeLists.txt:
1875         * wtf/Liveness.h: Added.
1876         (WTF::Liveness::Liveness):
1877         (WTF::Liveness::LocalCalc::LocalCalc):
1878         (WTF::Liveness::LocalCalc::Iterable::Iterable):
1879         (WTF::Liveness::LocalCalc::Iterable::iterator::iterator):
1880         (WTF::Liveness::LocalCalc::Iterable::iterator::operator++):
1881         (WTF::Liveness::LocalCalc::Iterable::iterator::operator*):
1882         (WTF::Liveness::LocalCalc::Iterable::iterator::operator==):
1883         (WTF::Liveness::LocalCalc::Iterable::iterator::operator!=):
1884         (WTF::Liveness::LocalCalc::Iterable::begin):
1885         (WTF::Liveness::LocalCalc::Iterable::end):
1886         (WTF::Liveness::LocalCalc::Iterable::contains):
1887         (WTF::Liveness::LocalCalc::live):
1888         (WTF::Liveness::LocalCalc::isLive):
1889         (WTF::Liveness::LocalCalc::execute):
1890         (WTF::Liveness::rawLiveAtHead):
1891         (WTF::Liveness::Iterable::Iterable):
1892         (WTF::Liveness::Iterable::iterator::iterator):
1893         (WTF::Liveness::Iterable::iterator::operator*):
1894         (WTF::Liveness::Iterable::iterator::operator++):
1895         (WTF::Liveness::Iterable::iterator::operator==):
1896         (WTF::Liveness::Iterable::iterator::operator!=):
1897         (WTF::Liveness::Iterable::begin):
1898         (WTF::Liveness::Iterable::end):
1899         (WTF::Liveness::Iterable::contains):
1900         (WTF::Liveness::liveAtHead):
1901         (WTF::Liveness::liveAtTail):
1902         (WTF::Liveness::workset):
1903         (WTF::Liveness::LiveAtHead::LiveAtHead):
1904         (WTF::Liveness::LiveAtHead::isLiveAtHead):
1905
1906 2017-03-25  Filip Pizlo  <fpizlo@apple.com>
1907
1908         Air::Liveness shouldn't need HashSets
1909         https://bugs.webkit.org/show_bug.cgi?id=170102
1910
1911         Reviewed by Yusuke Suzuki.
1912
1913         * wtf/IndexSparseSet.h: Add some helpers for a HashSet-free liveness analysis.
1914         (WTF::IndexSparseSet::values):
1915         (WTF::IndexSparseSet<OverflowHandler>::sort):
1916         * wtf/StdLibExtras.h:
1917         (WTF::mergeDeduplicatedSorted): Rapidly merge two sorted lists that don't have duplicates to produce a new sorted list that doesn't have duplicates.
1918         * wtf/Vector.h:
1919         (WTF::minCapacity>::uncheckedAppend): Inline this!
1920         (WTF::removeRepeatedElements): This is a version of std::unique() that works naturally for Vectors.
1921
1922 2017-03-26  Filip Pizlo  <fpizlo@apple.com>
1923
1924         Air should use RegisterSet for RegLiveness
1925         https://bugs.webkit.org/show_bug.cgi?id=170108
1926
1927         Reviewed by Yusuke Suzuki.
1928
1929         * wtf/Atomics.h:
1930         (WTF::ensurePointer): This is a useful replacement for std::once, which requires less fencing.
1931         * wtf/Bitmap.h: Add more utilities.
1932         (WTF::Bitmap::iterator::iterator): An iterator for set bits.
1933         (WTF::Bitmap::iterator::operator*):
1934         (WTF::Bitmap::iterator::operator++):
1935         (WTF::Bitmap::iterator::operator==):
1936         (WTF::Bitmap::iterator::operator!=):
1937         (WTF::Bitmap::begin):
1938         (WTF::Bitmap::end):
1939         (WTF::WordType>::subsumes): a.subsumes(b) if all of b's set bits are set in a.
1940         (WTF::WordType>::findBit): find next set or clear bit.
1941
1942 2017-03-24  JF Bastien  <jfbastien@apple.com>
1943
1944         WebAssembly: store state in TLS instead of on VM
1945         https://bugs.webkit.org/show_bug.cgi?id=169611
1946
1947         Reviewed by Filip Pizlo.
1948
1949         * wtf/FastTLS.h: reserve one key for WebAssembly, delete a bunch
1950         of dead code which clang couldn't compile (it's valid GCC assembly
1951         which LLVM dislikes).
1952
1953 2017-03-24  Ryan Haddad  <ryanhaddad@apple.com>
1954
1955         Unreviewed, rolling out r214351.
1956
1957         This change caused API test
1958         WebKit1.DidCreateJavaScriptContextBackForwardCacheTest to
1959         fail.
1960
1961         Reverted changeset:
1962
1963         "Make inactive web processes behave as though under memory
1964         pressure."
1965         https://bugs.webkit.org/show_bug.cgi?id=170042
1966         http://trac.webkit.org/changeset/214351
1967
1968 2017-03-24  Chris Dumez  <cdumez@apple.com>
1969
1970         Unreviewed, rolling out r214329.
1971
1972         Significantly regressed Speedometer
1973
1974         Reverted changeset:
1975
1976         "window.crypto.getRandomValues() uses the insecure RC4 RNG"
1977         https://bugs.webkit.org/show_bug.cgi?id=169623
1978         http://trac.webkit.org/changeset/214329
1979
1980 2017-03-24  Andreas Kling  <akling@apple.com>
1981
1982         Make inactive web processes behave as though under memory pressure.
1983         <https://webkit.org/b/170042>
1984
1985         Reviewed by Antti Koivisto.
1986
1987         Once a web process becomes inactive, let's try to reduce its impact
1988         on memory usage by treating it as if it's under memory pressure until
1989         it becomes active.
1990
1991         * wtf/MemoryPressureHandler.cpp:
1992         (WTF::MemoryPressureHandler::setProcessState):
1993         (WTF::MemoryPressureHandler::isUnderMemoryPressure):
1994         * wtf/MemoryPressureHandler.h:
1995         (WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
1996
1997 2017-03-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1998
1999         window.crypto.getRandomValues() uses the insecure RC4 RNG
2000         https://bugs.webkit.org/show_bug.cgi?id=169623
2001
2002         Reviewed by Alex Christensen.
2003
2004         Remove the RC4 random generator in favor of using OS randomness for now. This is basically
2005         a merge of https://codereview.chromium.org/1431233002 from Blink, original author "eroman".
2006
2007         * wtf/CryptographicallyRandomNumber.cpp:
2008         (WTF::cryptographicallyRandomNumber):
2009         (WTF::cryptographicallyRandomValues):
2010         (): Deleted.
2011
2012 2017-03-23  Tomas Popela  <tpopela@redhat.com>
2013
2014         Fix uninitialized public members in WTF
2015         https://bugs.webkit.org/show_bug.cgi?id=169676
2016
2017         Reviewed by Michael Catanzaro.
2018
2019         Found by Coverity scan.
2020
2021         * wtf/Bag.h:
2022         * wtf/HashTable.h:
2023         * wtf/HashTraits.h:
2024         * wtf/Insertion.h:
2025         * wtf/OrderMaker.h:
2026         * wtf/ParallelJobsGeneric.h:
2027
2028 2017-03-22  Andreas Kling  <akling@apple.com>
2029
2030         Let MemoryPressureHandler track whether the process is active or inactive.
2031         <https://webkit.org/b/169990>
2032
2033         Reviewed by Antti Koivisto.
2034
2035         An active process is a process that meets any of these criteria:
2036
2037             - Has had a visible Page in an active window in the last hour
2038             - Is playing audio
2039
2040         This replaces the old mechanism where MemoryPressureHandler would invoke
2041         a callback to know whether the process was eligible for a memory kill.
2042         Instead we now plumb the relevant information down from WebCore and kill
2043         based on this activity state.
2044
2045         * wtf/MemoryPressureHandler.cpp:
2046         (WTF::MemoryPressureHandler::measurementTimerFired):
2047         (WTF::MemoryPressureHandler::setProcessState):
2048         * wtf/MemoryPressureHandler.h:
2049         (WTF::MemoryPressureHandler::setMemoryKillCallback):
2050         (WTF::MemoryPressureHandler::processState):
2051         (WTF::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback): Deleted.
2052
2053 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
2054
2055         Add a system trace point for memory warning handling
2056         https://bugs.webkit.org/show_bug.cgi?id=169893
2057
2058         Reviewed by Zalan Bujtas.
2059
2060         Make it possible to pass data to the Begin trace point.
2061
2062         * wtf/SystemTracing.h:
2063         (WTF::TraceScope::TraceScope):
2064
2065 2017-03-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
2066
2067         Time channel attack on SVG Filters
2068         https://bugs.webkit.org/show_bug.cgi?id=118689
2069
2070         Reviewed by Simon Fraser.
2071
2072         Performing arithmetic operations on subnormal floating-point numbers is
2073         very expensive. Normalizing the floating-point number to the minimum normal
2074         value should accelerate the calculations and there won't be a noticeable
2075         difference in the result since all the subnormal values and the minimum
2076         normal value are all very close to zero.
2077
2078         * wtf/MathExtras.h:
2079         (normalizedFloat):
2080
2081 2017-03-11  Filip Pizlo  <fpizlo@apple.com>
2082
2083         Air should be powerful enough to support Tmp-splitting
2084         https://bugs.webkit.org/show_bug.cgi?id=169515
2085
2086         Reviewed by Saam Barati.
2087         
2088         Teach IndexMap how to handle types that don't have a default constructor. This makes it
2089         easy to create a IndexMap<BasicBlock, InsertionSet>, which is a super powerful
2090         construct.
2091
2092         * wtf/IndexMap.h:
2093         (WTF::IndexMap::IndexMap):
2094         (WTF::IndexMap::resize):
2095         (WTF::IndexMap::clear):
2096
2097 2017-03-16  Simon Fraser  <simon.fraser@apple.com>
2098
2099         Improve the system tracing points
2100         https://bugs.webkit.org/show_bug.cgi?id=169790
2101
2102         Reviewed by Zalan Bujtas.
2103
2104         Use a more cohesive set of system trace points that give a good overview of what
2105         WebKit is doing. Added points for resource loading, render tree building, sync messages
2106         to the web process, async image decode, WASM and fetching cookies.
2107
2108         * wtf/SystemTracing.h:
2109
2110 2017-03-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2111
2112         [UNIX] Implement currentSearchLocaleID() and currentTextBreakLocaleID()
2113         https://bugs.webkit.org/show_bug.cgi?id=169745
2114
2115         Reviewed by Yusuke Suzuki.
2116
2117         Add a common implementation for Unix based ports using setlocale.
2118
2119         * wtf/PlatformGTK.cmake:
2120         * wtf/PlatformJSCOnly.cmake:
2121         * wtf/text/gtk/TextBreakIteratorInternalICUGtk.cpp: Removed.
2122         * wtf/text/unix/TextBreakIteratorInternalICUUnix.cpp: Renamed from Source/WTF/wtf/text/jsconly/TextBreakIteratorInternalICUJSCOnly.cpp.
2123         (WTF::currentSearchLocaleID):
2124         (WTF::currentTextBreakLocaleID):
2125
2126 2017-03-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2127
2128         [GLIB] MainThread implementation is not GTK+ specific
2129         https://bugs.webkit.org/show_bug.cgi?id=169736
2130
2131         Reviewed by Yusuke Suzuki.
2132
2133         It's implemented in MainThreadGLib.cpp for glib based ports, so ifdefs in MainThread should not be
2134         PLATFORM(GTK) but USE(GLIB).
2135
2136         * wtf/MainThread.cpp:
2137         * wtf/MainThread.h:
2138
2139 2017-03-15  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2140
2141         [CMake][JSCOnly] Fix build with GLib event loop
2142         https://bugs.webkit.org/show_bug.cgi?id=169730
2143
2144         Reviewed by Michael Catanzaro.
2145
2146         * wtf/MainThread.cpp:
2147         * wtf/PlatformJSCOnly.cmake: WorkQueueGLib was removed in r199713.
2148
2149 2017-03-15  Dean Jackson  <dino@apple.com>
2150
2151         Sort Xcode project files
2152         https://bugs.webkit.org/show_bug.cgi?id=169669
2153
2154         Reviewed by Antoine Quint.
2155
2156         * WTF.xcodeproj/project.pbxproj:
2157
2158 2017-03-14  Filip Pizlo  <fpizlo@apple.com>
2159
2160         Fix some typos in this benchmark.
2161
2162         Rubber stamped by Saam Barati.
2163
2164         * benchmarks/HashSetDFGReplay.cpp:
2165         (main):
2166
2167 2017-03-14  Filip Pizlo  <fpizlo@apple.com>
2168
2169         Record the HashSet/HashMap operations in DFG/FTL/B3 and replay them in a benchmark
2170         https://bugs.webkit.org/show_bug.cgi?id=169590
2171
2172         Reviewed by Saam Barati.
2173         
2174         This adds LoggingHashSet and LoggingHashMap, which are drop-in replacements for HashSet and
2175         HashMap that log everything that they do, so that you can replay it later.
2176         
2177         This also adds a benchmark (HashSetDFGReplay) based on doing a recording of some of the HashSets
2178         in the DFG compiler.
2179
2180         * WTF.xcodeproj/project.pbxproj:
2181         * benchmarks/HashSetDFGReplay.cpp: Added.
2182         (benchmark):
2183         (main):
2184         * wtf/CMakeLists.txt:
2185         * wtf/GlobalVersion.cpp: Added.
2186         (WTF::newGlobalVersion):
2187         * wtf/GlobalVersion.h: Added.
2188         * wtf/HashMap.h:
2189         (WTF::X>::swap):
2190         * wtf/HashSet.h:
2191         (WTF::V>::addVoid):
2192         * wtf/LoggingHashID.h: Added.
2193         (WTF::LoggingHashID::LoggingHashID):
2194         (WTF::LoggingHashID::dump):
2195         * wtf/LoggingHashMap.h: Added.
2196         * wtf/LoggingHashSet.h: Added.
2197         * wtf/LoggingHashTraits.h: Added.
2198         (WTF::LoggingHashKeyTraits::print):
2199         (WTF::LoggingHashValueTraits::print):
2200
2201 2017-03-13  Jer Noble  <jer.noble@apple.com>
2202
2203         Make classes used by Media Stream encode/decode friendly
2204         https://bugs.webkit.org/show_bug.cgi?id=169567
2205
2206         Reviewed by Eric Carlson.
2207
2208         * wtf/MediaTime.h:
2209         (WTF::MediaTime::encode):
2210         (WTF::MediaTime::decode):
2211
2212 2017-03-14  Yusuke Suzuki  <utatane.tea@gmail.com>
2213
2214         Add secondsAs<T> methods to Seconds to convert it to integers with clamp
2215         https://bugs.webkit.org/show_bug.cgi?id=169537
2216
2217         Reviewed by Carlos Garcia Campos.
2218
2219         When using the usual static_cast, infinity becomes 0 accidentally.
2220         It is not intended value when using Seconds for timeout value.
2221         Instead, we use clampToAccepting64 to convert Seconds to
2222         integer values to pass them to the system functions.
2223
2224         * wtf/MathExtras.h:
2225         (clampToAccepting64):
2226         * wtf/Seconds.h:
2227         (WTF::Seconds::minutesAs):
2228         (WTF::Seconds::secondsAs):
2229         (WTF::Seconds::millisecondsAs):
2230         (WTF::Seconds::microsecondsAs):
2231         (WTF::Seconds::nanosecondsAs):
2232         * wtf/cocoa/WorkQueueCocoa.cpp:
2233         (WTF::WorkQueue::dispatchAfter):
2234         * wtf/glib/RunLoopGLib.cpp:
2235         (WTF::RunLoop::dispatchAfter):
2236         (WTF::RunLoop::TimerBase::updateReadyTime):
2237
2238 2017-03-13  Yusuke Suzuki  <utatane.tea@gmail.com>
2239
2240         [JSC][Linux] Implement VMTrap in Linux ports
2241         https://bugs.webkit.org/show_bug.cgi?id=169436
2242
2243         Reviewed by Mark Lam.
2244
2245         Enable VMTrap mechanism for Linux and FreeBSD.
2246
2247         * wtf/Platform.h:
2248
2249 2017-03-13  Yusuke Suzuki  <utatane.tea@gmail.com>
2250
2251         [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
2252         https://bugs.webkit.org/show_bug.cgi?id=169537
2253
2254         Reviewed by Sam Weinig.
2255
2256         This patch modernizes RunLoop and WorkQueue.
2257
2258         1. Use Ref<> aggressively
2259         2. Use Seconds instead of chrono times
2260         3. Use Function<> instead of std::function
2261
2262         * wtf/MainThread.cpp:
2263         (WTF::dispatchFunctionsFromMainThread):
2264         * wtf/RunLoop.h:
2265         * wtf/WorkQueue.h:
2266         * wtf/cocoa/WorkQueueCocoa.cpp:
2267         (WTF::WorkQueue::dispatch):
2268         (WTF::WorkQueue::dispatchAfter):
2269         (WTF::WorkQueue::concurrentApply):
2270         * wtf/generic/MainThreadGeneric.cpp:
2271         (WTF::scheduleDispatchFunctionsOnMainThread):
2272         * wtf/generic/RunLoopGeneric.cpp:
2273         (WTF::RunLoop::TimerBase::ScheduledTask::create):
2274         (WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
2275         (WTF::RunLoop::populateTasks):
2276         (WTF::RunLoop::runImpl):
2277         (WTF::RunLoop::schedule):
2278         (WTF::RunLoop::scheduleAndWakeUp):
2279         (WTF::RunLoop::dispatchAfter):
2280         (WTF::RunLoop::TimerBase::start):
2281         * wtf/generic/WorkQueueGeneric.cpp:
2282         (WorkQueue::dispatch):
2283         (WorkQueue::dispatchAfter):
2284         * wtf/glib/RunLoopGLib.cpp:
2285         (WTF::DispatchAfterContext::DispatchAfterContext):
2286         (WTF::RunLoop::dispatchAfter):
2287         (WTF::RunLoop::TimerBase::updateReadyTime):
2288         (WTF::RunLoop::TimerBase::start):
2289         * wtf/win/WorkQueueWin.cpp:
2290         (WTF::WorkQueue::performWorkOnRegisteredWorkThread):
2291         (WTF::WorkQueue::dispatch):
2292         (WTF::WorkQueue::dispatchAfter):
2293
2294 2017-03-13  Chris Dumez  <cdumez@apple.com>
2295
2296         [WK2] Only report background WebProcesses as unresponsive in the background after 90 seconds
2297         https://bugs.webkit.org/show_bug.cgi?id=169425
2298         <rdar://problem/30954003>
2299
2300         Reviewed by Andreas Kling.
2301
2302         * wtf/RunLoop.h:
2303         (WTF::RunLoop::TimerBase::startRepeating):
2304         (WTF::RunLoop::TimerBase::startOneShot):
2305         Add overloads to RunLoop::Timer that take Seconds in parameter,
2306         for convenience.
2307
2308         * wtf/Seconds.h:
2309         (WTF::Seconds::fromHours):
2310         (WTF::seconds_literals::operator _h):
2311         Allow _h suffix for initializing Seconds type to hours.
2312
2313 2017-03-11  Csaba Osztrogonác  <ossy@webkit.org>
2314
2315         REGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
2316         https://bugs.webkit.org/show_bug.cgi?id=169510
2317
2318         Unreviewed, disable LL_SC on Linux to unbreak this platform.
2319
2320         * wtf/Atomics.h:
2321         * wtf/Platform.h:
2322
2323 2017-03-10  Filip Pizlo  <fpizlo@apple.com>
2324
2325         The JITs should be able to emit fast TLS loads
2326         https://bugs.webkit.org/show_bug.cgi?id=169483
2327
2328         Reviewed by Keith Miller.
2329
2330         Consolidated what we know about fast TLS in FastTLS.h.
2331
2332         * WTF.xcodeproj/project.pbxproj:
2333         * wtf/CMakeLists.txt:
2334         * wtf/FastTLS.h: Added.
2335         (WTF::loadFastTLS):
2336         (WTF::fastTLSOffsetForKey):
2337         * wtf/Platform.h:
2338         * wtf/WTFThreadData.cpp:
2339         (WTF::WTFThreadData::createAndRegisterForGetspecificDirect):
2340         * wtf/WTFThreadData.h:
2341         (WTF::wtfThreadData):
2342
2343 2017-03-10  Mark Lam  <mark.lam@apple.com>
2344
2345         Turn ENABLE(MASM_PROBE) on by default for OS(DARWIN) release builds.
2346         https://bugs.webkit.org/show_bug.cgi?id=169493
2347
2348         Reviewed by Saam Barati.
2349
2350         MASM_PROBE was already enabled for debug builds.  This change makes it so that we
2351         don't have to rebuild the world every time we need to use it on a release build.
2352
2353         * wtf/Platform.h:
2354
2355 2017-03-10  Csaba Osztrogonác  <ossy@webkit.org>
2356
2357         Unreviewed AArch64 Linux buildfix after r213645.
2358         https://bugs.webkit.org/show_bug.cgi?id=169300
2359
2360         * wtf/Atomics.h: intptr_t and int64_t are typedefs for long int on Linux.
2361         They are different types only on Darwin platforms.
2362
2363 2017-03-09  Caio Lima  <ticaiolima@gmail.com>
2364
2365         [ESnext] Implement Object Rest - Implementing Object Rest Destructuring
2366         https://bugs.webkit.org/show_bug.cgi?id=167962
2367
2368         Reviewed by Keith Miller.
2369
2370         * wtf/HashSet.h:
2371         (WTF::=):
2372
2373 2017-03-09  Youenn Fablet  <youenn@apple.com>
2374
2375         Activate VideoToolbox when WebRTC is enabled on iOS
2376         https://bugs.webkit.org/show_bug.cgi?id=169423
2377
2378         Reviewed by Jon Lee.
2379
2380         * wtf/Platform.h: Activate VIDEOTOOLBOX if WEBRTC is enabled.
2381
2382 2017-03-09  Filip Pizlo  <fpizlo@apple.com>
2383
2384         std::isnan/isinf/isfinite should work with WTF time classes
2385         https://bugs.webkit.org/show_bug.cgi?id=164991
2386
2387         Reviewed by Darin Adler.
2388         
2389         The consensus view (see comments in https://bugs.webkit.org/show_bug.cgi?id=152045) of how
2390         to check if something is NaN is to use std::isnan(). To be able to do that for time
2391         classes, they need to provide their own isnan() overhload. This also provides isinf()
2392         overloads.
2393
2394         * wtf/MonotonicTime.h:
2395         (std::isnan):
2396         (std::isinf):
2397         * wtf/Seconds.h:
2398         (std::isnan):
2399         (std::isinf):
2400         * wtf/TimeWithDynamicClockType.h:
2401         (std::isnan):
2402         (std::isinf):
2403         * wtf/WallTime.h:
2404         (std::isnan):
2405         (std::isinf):
2406
2407 2017-03-09  Mark Lam  <mark.lam@apple.com>
2408
2409         Use const AbstractLocker& (instead of const LockHolder&) in more places.
2410         https://bugs.webkit.org/show_bug.cgi?id=169424
2411
2412         Reviewed by Filip Pizlo.
2413
2414         * wtf/RunLoop.h:
2415         * wtf/generic/RunLoopGeneric.cpp:
2416         (WTF::RunLoop::wakeUp):
2417         (WTF::RunLoop::schedule):
2418
2419 2017-03-09  Mark Lam  <mark.lam@apple.com>
2420
2421         Make the VM Traps mechanism non-polling for the DFG and FTL.
2422         https://bugs.webkit.org/show_bug.cgi?id=168920
2423         <rdar://problem/30738588>
2424
2425         Reviewed by Filip Pizlo.
2426
2427         Make StackBounds more useful for checking if a pointer is within stack bounds.
2428
2429         * wtf/MetaAllocator.cpp:
2430         (WTF::MetaAllocator::isInAllocatedMemory):
2431         * wtf/MetaAllocator.h:
2432         * wtf/Platform.h:
2433         * wtf/StackBounds.h:
2434         (WTF::StackBounds::emptyBounds):
2435         (WTF::StackBounds::StackBounds):
2436         (WTF::StackBounds::isEmpty):
2437         (WTF::StackBounds::contains):
2438
2439 2017-03-07  Filip Pizlo  <fpizlo@apple.com>
2440
2441         WTF should make it super easy to do ARM concurrency tricks
2442         https://bugs.webkit.org/show_bug.cgi?id=169300
2443
2444         Reviewed by Mark Lam.
2445         
2446         This adds Atomic<>::loadLink and Atomic<>::storeCond, available only when HAVE(LL_SC).
2447         
2448         It abstracts loadLink/storeCond behind prepare/attempt. You can write prepare/attempt
2449         loops whenever your loop fits into the least common denominator of LL/SC and CAS.
2450         
2451         This modifies Atomic<>::transaction to use prepare/attempt. So, if you write your loop
2452         using Atomic<>::transaction, then you get LL/SC for free.
2453
2454         Depending on the kind of transaction you are doing, you may not want to perform an LL
2455         until you have a chance to just load the current value. Atomic<>::transaction() assumes
2456         that you do not care to have any ordering guarantees in that case. If you think that
2457         the transaction has a good chance of aborting this way, you want
2458         Atomic<>::transaction() to first do a plain load. But if you don't think that such an
2459         abort is likely, then you want to go straight to the LL. The API supports this concept
2460         via TransactionAbortLikelihood.
2461         
2462         Additionally, this redoes the depend/consume API to be dead simple. Dependency is
2463         unsigned. You get a dependency on a loaded value by just saying
2464         dependency(loadedValue). You consume the dependency by using it as a bonus index to
2465         some pointer dereference. This is made easy with the consume<T*>(ptr, dependency)
2466         helper. In those cases where you want to pass around both a computed value and a
2467         dependency, there's DependencyWith<T>. But you won't need it in most cases. The loaded
2468         value or any value computed from the loaded value is a fine input to dependency()!
2469         
2470         This change updates a bunch of hot paths to use the new APIs. Using transaction() gives
2471         us optimal LL/SC loops for object marking and lock acquisition.
2472         
2473         This change also updates a bunch of hot paths to use dependency()/consume().
2474         
2475         This is a significant Octane/splay speed-up on ARM.
2476
2477         * wtf/Atomics.h:
2478         (WTF::hasFence):
2479         (WTF::Atomic::prepare):
2480         (WTF::Atomic::attempt):
2481         (WTF::Atomic::transaction):
2482         (WTF::Atomic::transactionRelaxed):
2483         (WTF::nullDependency):
2484         (WTF::dependency):
2485         (WTF::DependencyWith::DependencyWith):
2486         (WTF::dependencyWith):
2487         (WTF::consume):
2488         (WTF::Atomic::tryTransactionRelaxed): Deleted.
2489         (WTF::Atomic::tryTransaction): Deleted.
2490         (WTF::zeroWithConsumeDependency): Deleted.
2491         (WTF::consumeLoad): Deleted.
2492         * wtf/Bitmap.h:
2493         (WTF::WordType>::get):
2494         (WTF::WordType>::concurrentTestAndSet):
2495         (WTF::WordType>::concurrentTestAndClear):
2496         * wtf/LockAlgorithm.h:
2497         (WTF::LockAlgorithm::lockFast):
2498         (WTF::LockAlgorithm::unlockFast):
2499         (WTF::LockAlgorithm::unlockSlow):
2500         * wtf/Platform.h:
2501
2502 2017-03-08  Anders Carlsson  <andersca@apple.com>
2503
2504         Simplify the PaymentCoordinator interface
2505         https://bugs.webkit.org/show_bug.cgi?id=169382
2506         Part of rdar://problem/28880714.
2507
2508         Reviewed by Tim Horton.
2509
2510         * wtf/EnumTraits.h:
2511         Fix a build warning.
2512
2513 2017-03-06  Andreas Kling  <akling@apple.com>
2514
2515         [iOS] Report domains crashing under memory pressure via enhanced privacy logging.
2516         <https://webkit.org/b/169133>
2517         <rdar://problem/29964017>
2518
2519         Reviewed by Antti Koivisto.
2520
2521         Add a mechanism for getting a callback when the memory pressure status changes.
2522
2523         * wtf/MemoryPressureHandler.cpp:
2524         (WTF::MemoryPressureHandler::measurementTimerFired):
2525         (WTF::MemoryPressureHandler::beginSimulatedMemoryPressure):
2526         (WTF::MemoryPressureHandler::endSimulatedMemoryPressure):
2527         (WTF::MemoryPressureHandler::setUnderMemoryPressure):
2528         (WTF::MemoryPressureHandler::memoryPressureStatusChanged):
2529         * wtf/MemoryPressureHandler.h:
2530         (WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
2531         (WTF::MemoryPressureHandler::setUnderMemoryPressure): Deleted.
2532
2533 2017-03-03  Jer Noble  <jer.noble@apple.com>
2534
2535         [Win64] '__int128_t': undeclared identifier in MediaTime.cpp
2536         https://bugs.webkit.org/show_bug.cgi?id=169123
2537
2538         Reviewed by Alex Christensen.
2539
2540         Don't perform the 128-bit optimized path on Windows, where the __int128_t intrinsic isn't available.
2541
2542         * wtf/MediaTime.cpp:
2543         (WTF::MediaTime::setTimeScale):
2544
2545 2017-03-03  Keith Miller  <keith_miller@apple.com>
2546
2547         WASM should support faster loads.
2548         https://bugs.webkit.org/show_bug.cgi?id=162693
2549
2550         Reviewed by Saam Barati.
2551
2552         Add new forms of dataLog that take a boolean which describes if the log should happen. This makes cases where we have a static const bool for printing nicer since you can do:
2553
2554         dataLogIf(verbose, things, to, print);
2555
2556         instead of:
2557
2558         if (verbose)
2559             dataLog(things, to, print);
2560
2561         Also, add a operator! to Ref that has the same semantics as C++ refs.
2562
2563         * wtf/DataLog.h:
2564         (WTF::dataLogLn):
2565         (WTF::dataLogIf):
2566         (WTF::dataLogLnIf):
2567         * wtf/Ref.h:
2568         (WTF::Ref::operator!):
2569
2570 2017-03-02  Jer Noble  <jer.noble@apple.com>
2571
2572         Sufficently large timeValue and timeScale arguments to MediaTime will cause wrapping in toTimeScale().
2573         https://bugs.webkit.org/show_bug.cgi?id=169098
2574
2575         Reviewed by Keith Miller.
2576
2577         Use a non-standard but Clang & GCC supported __int128_t type extension to do the 128-bit math rather than
2578         rolling our own. Since this is only available in 64-bit builds, for 32-bit, just fix the underlying 128-bit
2579         math.
2580
2581         * wtf/MediaTime.cpp:
2582         (WTF::MediaTime::setTimeScale):
2583
2584 2017-03-01  Konstantin Tokarev  <annulen@yandex.ru>
2585
2586         Removed unused WTF_COMPILER_SUPPORTS_CXX_USER_LITERALS macro
2587         https://bugs.webkit.org/show_bug.cgi?id=168969
2588
2589         Reviewed by Darin Adler.
2590
2591         * wtf/Compiler.h:
2592
2593 2017-03-01  Tomas Popela  <tpopela@redhat.com>
2594
2595         [WTF] va_list is not ended in StringPrintStream
2596         https://bugs.webkit.org/show_bug.cgi?id=169035
2597
2598         Reviewed by Michael Saboff.
2599
2600         Also fix whitespace errors while touching this file.
2601
2602         * wtf/StringPrintStream.cpp:
2603         (WTF::StringPrintStream::vprintf):
2604         (WTF::StringPrintStream::increaseSize):
2605
2606 2017-03-01  Andreas Kling  <akling@apple.com>
2607
2608         Move MemoryPressureHandler to WTF
2609         <https://webkit.org/b/168908>
2610
2611         Reviewed by Sam Weinig.
2612
2613         Move MemoryPressureHandler down to WTF so it can be used from JavaScriptCore.
2614
2615         I had to do a blind rewrite of the Windows memory checking timer since it can
2616         no longer use WebCore::Timer. I also moved the Win32Handle helper class to WTF.
2617
2618         * WTF.xcodeproj/project.pbxproj:
2619         * wtf/CMakeLists.txt:
2620         * wtf/MemoryPressureHandler.cpp: Renamed from Source/WebCore/platform/MemoryPressureHandler.cpp.
2621         (WTF::MemoryPressureHandler::singleton):
2622         (WTF::MemoryPressureHandler::MemoryPressureHandler):
2623         (WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
2624         (WTF::toString):
2625         (WTF::thresholdForPolicy):
2626         (WTF::policyForFootprint):
2627         (WTF::MemoryPressureHandler::measurementTimerFired):
2628         (WTF::MemoryPressureHandler::beginSimulatedMemoryPressure):
2629         (WTF::MemoryPressureHandler::endSimulatedMemoryPressure):
2630         (WTF::MemoryPressureHandler::releaseMemory):
2631         (WTF::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
2632         (WTF::MemoryPressureHandler::install):
2633         (WTF::MemoryPressureHandler::uninstall):
2634         (WTF::MemoryPressureHandler::holdOff):
2635         (WTF::MemoryPressureHandler::respondToMemoryPressure):
2636         (WTF::MemoryPressureHandler::platformReleaseMemory):
2637         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
2638         (WTF::MemoryPressureHandler::platformInitialize):
2639         * wtf/MemoryPressureHandler.h: Renamed from Source/WebCore/platform/MemoryPressureHandler.h.
2640         (WTF::MemoryPressureHandler::setMemoryKillCallback):
2641         (WTF::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
2642         (WTF::MemoryPressureHandler::setLowMemoryHandler):
2643         (WTF::MemoryPressureHandler::isUnderMemoryPressure):
2644         (WTF::MemoryPressureHandler::setUnderMemoryPressure):
2645         (WTF::MemoryPressureHandler::ReliefLogger::ReliefLogger):
2646         (WTF::MemoryPressureHandler::ReliefLogger::~ReliefLogger):
2647         (WTF::MemoryPressureHandler::ReliefLogger::logString):
2648         (WTF::MemoryPressureHandler::ReliefLogger::setLoggingEnabled):
2649         (WTF::MemoryPressureHandler::ReliefLogger::loggingEnabled):
2650         (WTF::MemoryPressureHandler::ReliefLogger::MemoryUsage::MemoryUsage):
2651         * wtf/PlatformEfl.cmake:
2652         * wtf/PlatformGTK.cmake:
2653         * wtf/PlatformMac.cmake:
2654         * wtf/PlatformWin.cmake:
2655         * wtf/cocoa/MemoryPressureHandlerCocoa.mm: Renamed from Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm.
2656         (WTF::MemoryPressureHandler::platformReleaseMemory):
2657         (WTF::MemoryPressureHandler::install):
2658         (WTF::MemoryPressureHandler::uninstall):
2659         (WTF::MemoryPressureHandler::holdOff):
2660         (WTF::MemoryPressureHandler::respondToMemoryPressure):
2661         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
2662         * wtf/linux/CurrentProcessMemoryStatus.cpp: Renamed from Source/WebCore/platform/linux/CurrentProcessMemoryStatus.cpp.
2663         (WTF::systemPageSize):
2664         (WTF::currentProcessMemoryStatus):
2665         * wtf/linux/CurrentProcessMemoryStatus.h: Renamed from Source/WebCore/platform/linux/CurrentProcessMemoryStatus.h.
2666         * wtf/linux/MemoryPressureHandlerLinux.cpp: Renamed from Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp.
2667         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
2668         * wtf/win/MemoryPressureHandlerWin.cpp: Renamed from Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp.
2669         (WTF::MemoryPressureHandler::platformInitialize):
2670         (WTF::MemoryPressureHandler::windowsMeasurementTimerFired):
2671         (WTF::MemoryPressureHandler::platformReleaseMemory):
2672         (WTF::MemoryPressureHandler::install):
2673         (WTF::MemoryPressureHandler::uninstall):
2674         (WTF::MemoryPressureHandler::holdOff):
2675         (WTF::MemoryPressureHandler::respondToMemoryPressure):
2676         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
2677         * wtf/win/Win32Handle.h: Renamed from Source/WebCore/platform/win/Win32Handle.h.
2678         (WTF::Win32Handle::Win32Handle):
2679         (WTF::Win32Handle::~Win32Handle):
2680         (WTF::Win32Handle::clear):
2681         (WTF::Win32Handle::isValid):
2682         (WTF::Win32Handle::get):
2683         (WTF::Win32Handle::release):
2684         (WTF::Win32Handle::operator=):
2685
2686 2017-02-28  Chris Dumez  <cdumez@apple.com>
2687
2688         [iOS] Throttle requestAnimationFrame to 30fps in low power mode
2689         https://bugs.webkit.org/show_bug.cgi?id=168837
2690         <rdar://problem/30700929>
2691
2692         Reviewed by Simon Fraser.
2693
2694         Add support for operator -= on WTF::OptionSet for convenience:
2695             set -= Enum::A;
2696         looks much better than:
2697             set = set - Enum::A;
2698
2699         * wtf/OptionSet.h:
2700         (WTF::OptionSet::operator-=):
2701
2702 2017-02-28  Michael Saboff  <msaboff@apple.com>
2703
2704         Add ability to configure JSC options from a file
2705         https://bugs.webkit.org/show_bug.cgi?id=168914
2706
2707         Reviewed by Filip Pizlo.
2708
2709         Added the ability to set options and DataLog file location via a configuration file.
2710         The pathname can include the printf style "%pid", which will be replaced with the
2711         current process id.
2712
2713         * wtf/DataLog.cpp:
2714         (WTF::initializeLogFileOnce):
2715         (WTF::setDataFile):
2716         * wtf/DataLog.h:
2717
2718 2017-02-27  Andy Estes  <aestes@apple.com>
2719
2720         [iOS] Enable file replacement
2721         https://bugs.webkit.org/show_bug.cgi?id=168907
2722         <rdar://problem/22258242>
2723
2724         Reviewed by David Kilzer.
2725
2726         * wtf/FeatureDefines.h: Set ENABLE_FILE_REPLACEMENT to 1 on all Cocoa platforms.
2727
2728 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
2729
2730         Rename ICU cursor iterator to caret iterator
2731         https://bugs.webkit.org/show_bug.cgi?id=168206
2732
2733         Reviewed by Simon Fraser.
2734
2735         * wtf/text/TextBreakIterator.cpp:
2736         (WTF::mapModeToBackingIterator):
2737         * wtf/text/TextBreakIterator.h:
2738         * wtf/text/cf/TextBreakIteratorCF.h:
2739         (WTF::TextBreakIteratorCF::TextBreakIteratorCF):
2740         * wtf/text/icu/TextBreakIteratorICU.h:
2741         (WTF::caretRules):
2742         (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
2743         (WTF::cursorRules): Deleted.
2744         * wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
2745         (WTF::mapModeToBackingIterator):
2746
2747 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
2748
2749         Use RAII for ICU breaking iterators
2750         https://bugs.webkit.org/show_bug.cgi?id=168203
2751
2752         Reviewed by Simon Fraser.
2753
2754         * wtf/text/TextBreakIterator.h:
2755         (WTF::CachedTextBreakIterator::CachedTextBreakIterator):
2756         (WTF::CachedTextBreakIterator::~CachedTextBreakIterator):
2757         (WTF::CachedTextBreakIterator::preceding):
2758         (WTF::CachedTextBreakIterator::following):
2759         (WTF::CachedTextBreakIterator::isBoundary):
2760
2761 2017-02-24  Jer Noble  <jer.noble@apple.com>
2762
2763         Add public method to MediaTime for doing timeScale conversion.
2764         https://bugs.webkit.org/show_bug.cgi?id=168860
2765
2766         Reviewed by Eric Carlson.
2767
2768         The newly public method, modeled on CMTimeConvertScale, allows callers to specify what rounding technique
2769         will be used when converting to a new time scale.
2770
2771         * wtf/MediaTime.cpp:
2772         (WTF::MediaTime::toTimeScale):
2773         (WTF::MediaTime::setTimeScale):
2774         * wtf/MediaTime.h:
2775
2776 2017-02-26  Myles C. Maxfield  <mmaxfield@apple.com>
2777
2778         Stop compiling our own cursorMovementIterator()
2779         https://bugs.webkit.org/show_bug.cgi?id=168211
2780
2781         Reviewed by David Hyatt.
2782
2783         This patch creates a unified Text Breaking API, which can be backed by either ICU
2784         or CoreFoundation (for ports which can use it). Rather than using inheritance and
2785         virtual functions to implement this, because there are only two subclasses, the
2786         simpler option of just using a Variant is used instead. There is also a cache which
2787         allows you to reuse iterators without reconstructing them. This cache is better
2788         than the previous method of having a single static iterator because the cache
2789         lets you use two iterators simultaneously.
2790
2791         In the future, I will hook up all iterators to use this shared class. However, for
2792         this patch, I've only hooked up the caret position iterator (backed by CoreFoundation
2793         on Cocoa ports and UBRK_CHARACTER on other ports). 
2794
2795         * WTF.xcodeproj/project.pbxproj:
2796         * wtf/spi/cf/CFStringSPI.h: Added.
2797         * wtf/text/TextBreakIterator.cpp:
2798         (WTF::initializeIteratorWithRules): Deleted.
2799         (WTF::cursorMovementIterator): Deleted.
2800         * wtf/text/TextBreakIterator.h:
2801         (WTF::TextBreakIterator::preceding):
2802         (WTF::TextBreakIterator::following):
2803         (WTF::TextBreakIterator::isBoundary):
2804         (WTF::TextBreakIterator::setText):
2805         (WTF::TextBreakIterator::mode):
2806         (WTF::TextBreakIterator::locale):
2807         (WTF::TextBreakIteratorCache::singleton):
2808         (WTF::TextBreakIteratorCache::take):
2809         (WTF::TextBreakIteratorCache::put):
2810         (WTF::TextBreakIteratorCache::TextBreakIteratorCache):
2811         * wtf/text/cf/TextBreakIteratorCF.h: Added.
2812         (WTF::TextBreakIteratorCF::TextBreakIteratorCF):
2813         (WTF::TextBreakIteratorCF::setText):
2814         (WTF::TextBreakIteratorCF::preceding):
2815         (WTF::TextBreakIteratorCF::following):
2816         (WTF::TextBreakIteratorCF::isBoundary):
2817         * wtf/text/icu/TextBreakIteratorICU.h: Added.
2818         (WTF::TextBreakIteratorICU::set8BitText):
2819         (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
2820         (WTF::TextBreakIteratorICU::operator=):
2821         (WTF::TextBreakIteratorICU::~TextBreakIteratorICU):
2822         (WTF::TextBreakIteratorICU::setText):
2823         (WTF::TextBreakIteratorICU::preceding):
2824         (WTF::TextBreakIteratorICU::following):
2825         (WTF::TextBreakIteratorICU::isBoundary):
2826         * wtf/text/icu/UTextProviderLatin1.h:
2827         * wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
2828         (WTF::mapModeToBackingIterator):
2829         (WTF::TextBreakIterator::TextBreakIterator):
2830
2831 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
2832
2833         [Resource Timing] Gather timing information with reliable responseEnd time
2834         https://bugs.webkit.org/show_bug.cgi?id=168351
2835
2836         Reviewed by Alex Christensen.
2837
2838         * wtf/persistence/Coders.h:
2839         (WTF::Persistence::Coder<Seconds>::encode):
2840         (WTF::Persistence::Coder<Seconds>::decode):
2841
2842 2017-02-24  Keith Miller  <keith_miller@apple.com>
2843
2844         Rubber-stamped by Chris Dumez.
2845
2846         Replace typename Bool with typename BoolType because X11 has
2847         #define Bool int for some unknown reason...
2848
2849         * wtf/HashFunctions.h:
2850         (WTF::TupleHash::allTrue):
2851         * wtf/HashTraits.h:
2852         (WTF::TupleHashTraits::allTrue):
2853
2854 2017-02-24  Chris Dumez  <cdumez@apple.com>
2855
2856         Unreviewed, rolling out r212944.
2857
2858         Caused a lot of failures on the debug bots
2859
2860         Reverted changeset:
2861
2862         "[Resource Timing] Gather timing information with reliable
2863         responseEnd time"
2864         https://bugs.webkit.org/show_bug.cgi?id=168351
2865         http://trac.webkit.org/changeset/212944
2866
2867 2017-02-24  Keith Miller  <keith_miller@apple.com>
2868
2869         We should be able to use std::tuples as keys in HashMap
2870         https://bugs.webkit.org/show_bug.cgi?id=168805
2871
2872         Reviewed by Filip Pizlo.
2873
2874         This patch adds support for using std::tupeles as the key
2875         type in HashMap. It is equivalent to doing a sequence of
2876         std::pairs but has a nicer syntax.
2877
2878         * wtf/HashFunctions.h:
2879         (WTF::TupleHash::hash):
2880         (WTF::TupleHash::equal):
2881         (WTF::TupleHash::allTrue):
2882         * wtf/HashTraits.h:
2883         (WTF::TupleHashTraits::allTrue):
2884         (WTF::TupleHashTraits::emptyValue):
2885         (WTF::TupleHashTraits::constructDeletedValue):
2886         (WTF::TupleHashTraits::isDeletedValue):
2887
2888 2017-02-24  Alex Christensen  <achristensen@webkit.org>
2889
2890         Prepare to enable WebRTC on iOS
2891         https://bugs.webkit.org/show_bug.cgi?id=168811
2892
2893         Reviewed by Youenn Fablet.
2894
2895         * wtf/Platform.h:
2896
2897 2017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
2898
2899         [Resource Timing] Gather timing information with reliable responseEnd time
2900         https://bugs.webkit.org/show_bug.cgi?id=168351
2901
2902         Reviewed by Alex Christensen.
2903
2904         * wtf/persistence/Coders.h:
2905         (WTF::Persistence::Coder<Seconds>::encode):
2906         (WTF::Persistence::Coder<Seconds>::decode):
2907
2908 2017-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2909
2910         Better handle Thread and RunLoop initialization
2911         https://bugs.webkit.org/show_bug.cgi?id=167828
2912
2913         Reviewed by Yusuke Suzuki.
2914
2915         Make initialization functions more independent so that they can run in different
2916         order. WTF::initializeMainThread initializes WTF threading, so that neither WTF nor JSC theading need to be
2917         initialized before. RunLoop::initializeMainRunLoop() requires main thread to be initialized in some
2918         ports, so it initializes main thread too. WebKit1 always calls WTF::initializeMainThreadToProcessMainThread()
2919         before RunLoop::initializeMainRunLoop() so there's no problem there. GC threads are initialized alwayas by the
2920         main thread. The rules should be simpler now:
2921
2922           - JSC::initializeThreading: should always be called when JSC is used.
2923           - WTF::initializeThreading: only needs to be explicitly called when JSC is not used and process doesn't
2924             initialize a main thread or main run loop.
2925           - WTF::initializeMainThread: only needs to be explicitly called if process initializes a main thread but not a
2926             main run loop.
2927           - WTF::initializeMainThreadToProcessMainThread(): should always be called in WebKit1 before
2928             RunLoop::initializeMainRunLoop().
2929           - RunLoop::initializeMainRunLoop(): to initialize the main run loop. The only requirement is JSC::initializeThreading()
2930             to be called before if JSC is used.
2931
2932         * wtf/MainThread.cpp:
2933         (WTF::initializeMainThreadOnce): Use pthread_once to initialize the main thread also in GTK+ port.
2934         (WTF::initializeMainThreadToProcessMainThreadOnce): Call initializeThreading() before the platform
2935         initialization and initializeGCThreads() after it.
2936         (WTF::initializeMainThread): Ditto.
2937         * wtf/RunLoop.cpp:
2938         (WTF::RunLoop::initializeMainRunLoop): Call initializeMainThread().
2939         * wtf/glib/MainThreadGLib.cpp:
2940         (WTF::initializeMainThreadPlatform):
2941         (WTF::isMainThread):
2942         * wtf/mac/MainThreadMac.mm:
2943         (WTF::initializeMainThreadPlatform): Remove call to initializeGCThreads().
2944         (WTF::initializeMainThreadToProcessMainThreadPlatform): Ditto.
2945
2946 2017-02-22  Myles C. Maxfield  <mmaxfield@apple.com>
2947
2948         [Cocoa] Remove Yosemite-specific font lookup code
2949         https://bugs.webkit.org/show_bug.cgi?id=168682
2950
2951         Reviewed by Zalan Bujtas.
2952
2953         * wtf/Platform.h:
2954
2955 2017-02-22  Keith Miller  <keith_miller@apple.com>
2956
2957         Remove the demand executable allocator
2958         https://bugs.webkit.org/show_bug.cgi?id=168754
2959
2960         Reviewed by Saam Barati.
2961
2962         * wtf/Platform.h:
2963
2964 2017-02-22  Alex Christensen  <achristensen@webkit.org>
2965
2966         Re-commit part of r212812 accidentally rolled out with r212841.
2967         https://bugs.webkit.org/show_bug.cgi?id=167293
2968
2969         * wtf/Platform.h:
2970         Use libwebrtc on Mac if webrtc is enabled.
2971
2972 2017-02-22  Alex Christensen  <achristensen@webkit.org>
2973
2974         Fix ASAN build after activating libwebrtc.
2975
2976         * wtf/Ref.h:
2977         __asan_address_is_poisoned returns an int, not a bool.
2978         This didn't cause a problem before because we didn't include the real definition anywhere,
2979         but libwebrtc includes <sanitizer/asan_interface.h> directly now so the return types need to be correct.
2980
2981 2017-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2982
2983         [GTK] Test fast/events/message-port-postMessage-recursive.html times out
2984         https://bugs.webkit.org/show_bug.cgi?id=168570
2985
2986         Reviewed by Michael Catanzaro.
2987
2988         This has recently been added and the patch is good. It's just revealing a problem with our timers. The test is
2989         posting a message recursively, and also starts a timeout timer to finish the test. The timeout timer is never
2990         fired for us, because WebCore timers have lower priority than the one used by postMessage. ScriptExecutionContext
2991         uses Document::postTask, that uses scheduleOnMainThread, that uses RunLoop::dispatch(). We are not setting any
2992         priority for the timer used by RunLoop::dispatch, so it's using the default.
2993         Use a RunLoop::Timer to schedule tasks to the main thread instead of using RunLoop::dispatch(). This allows us
2994         to use a different priority, that is now set to G_PRIORITY_HIGH_IDLE + 20 to match WebCore timers. But it also
2995         avoids the double queue we had with RunLoop::dispatch(), because scheduleOnMainThread() also queues the tasks.
2996
2997         * wtf/glib/MainThreadGLib.cpp:
2998         (WTF::MainThreadDispatcher::MainThreadDispatcher):
2999         (WTF::MainThreadDispatcher::schedule):
3000         (WTF::MainThreadDispatcher::fired):
3001         (WTF::scheduleDispatchFunctionsOnMainThread):
3002
3003 2017-02-21  Youenn Fablet  <youenn@apple.com>
3004
3005         [WebRTC][Mac] Activate libwebrtc
3006         https://bugs.webkit.org/show_bug.cgi?id=167293
3007
3008         Reviewed by Alex Christensen.
3009
3010         * wtf/Platform.h:
3011
3012 2017-02-20  Filip Pizlo  <fpizlo@apple.com>
3013
3014         The collector thread should only start when the mutator doesn't have heap access
3015         https://bugs.webkit.org/show_bug.cgi?id=167737
3016
3017         Reviewed by Keith Miller.
3018         
3019         Extend the use of AbstractLocker so that we can use more locking idioms.
3020
3021         * wtf/AutomaticThread.cpp:
3022         (WTF::AutomaticThreadCondition::notifyOne):
3023         (WTF::AutomaticThreadCondition::notifyAll):
3024         (WTF::AutomaticThreadCondition::add):
3025         (WTF::AutomaticThreadCondition::remove):
3026         (WTF::AutomaticThreadCondition::contains):
3027         (WTF::AutomaticThread::AutomaticThread):
3028         (WTF::AutomaticThread::tryStop):
3029         (WTF::AutomaticThread::isWaiting):
3030         (WTF::AutomaticThread::notify):
3031         (WTF::AutomaticThread::start):
3032         (WTF::AutomaticThread::threadIsStopping):
3033         * wtf/AutomaticThread.h:
3034         * wtf/NumberOfCores.cpp:
3035         (WTF::numberOfProcessorCores):
3036         * wtf/ParallelHelperPool.cpp:
3037         (WTF::ParallelHelperClient::finish):
3038         (WTF::ParallelHelperClient::claimTask):
3039         (WTF::ParallelHelperPool::Thread::Thread):
3040         (WTF::ParallelHelperPool::didMakeWorkAvailable):
3041         (WTF::ParallelHelperPool::hasClientWithTask):
3042         (WTF::ParallelHelperPool::getClientWithTask):
3043         * wtf/ParallelHelperPool.h:
3044
3045 2017-02-21  Alex Christensen  <achristensen@webkit.org>
3046
3047         Unreviewed, rolling out r212699.
3048
3049         Internal build not ready
3050
3051         Reverted changeset:
3052
3053         "[WebRTC][Mac] Activate libwebrtc"
3054         https://bugs.webkit.org/show_bug.cgi?id=167293
3055         http://trac.webkit.org/changeset/212699
3056
3057 2017-02-20  Youenn Fablet  <youenn@apple.com>
3058
3059         [WebRTC][Mac] Activate libwebrtc
3060         https://bugs.webkit.org/show_bug.cgi?id=167293
3061
3062         Reviewed by Alex Christensen.
3063
3064         * wtf/Platform.h:
3065
3066 2017-02-20  Mark Lam  <mark.lam@apple.com>
3067
3068         [Re-landing] CachedCall should let GC know to keep its arguments alive.
3069         https://bugs.webkit.org/show_bug.cgi?id=168567
3070         <rdar://problem/30475767>
3071
3072         Reviewed by Saam Barati.
3073
3074         Added a WTF_FORBID_HEAP_ALLOCATION that will cause a compilation failure if
3075         a class declared with it is malloced.
3076
3077         While this doesn't prevent that class declared WTF_FORBID_HEAP_ALLOCATION from
3078         being embedded in another class that is heap allocated, it does at minimum
3079         document the intent and gives the users of this class a chance to do the
3080         right thing.
3081
3082         * WTF.xcodeproj/project.pbxproj:
3083         * wtf/ForbidHeapAllocation.h: Added.
3084
3085 2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>
3086
3087         Unreviewed, rolling out r212685.
3088
3089         This change broke the 32-bit Sierra build.
3090
3091         Reverted changeset:
3092
3093         "Resource Load Statistics: Add alternate classification
3094         method"
3095         https://bugs.webkit.org/show_bug.cgi?id=168347
3096         http://trac.webkit.org/changeset/212685
3097
3098 2017-02-20  John Wilander  <wilander@apple.com>
3099
3100         Resource Load Statistics: Add alternate classification method
3101         https://bugs.webkit.org/show_bug.cgi?id=168347
3102         <rdar://problem/30352793>
3103
3104         Reviewed by Alex Christensen.
3105
3106         * wtf/Platform.h:
3107             Added support for HAVE(CORE_PREDICTION).
3108
3109 2017-02-20  Commit Queue  <commit-queue@webkit.org>
3110
3111         Unreviewed, rolling out r212618.
3112         https://bugs.webkit.org/show_bug.cgi?id=168609
3113
3114         "Appears to cause PLT regression" (Requested by mlam on
3115         #webkit).
3116
3117         Reverted changeset:
3118
3119         "CachedCall should let GC know to keep its arguments alive."
3120         https://bugs.webkit.org/show_bug.cgi?id=168567
3121         http://trac.webkit.org/changeset/212618
3122
3123 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3124
3125         Unreviewed, rolling out r212622.
3126
3127         Caused several test failures
3128
3129         Reverted changeset:
3130
3131         "[GTK] Test fast/events/message-port-postMessage-
3132         recursive.html times out"
3133         https://bugs.webkit.org/show_bug.cgi?id=168570
3134         http://trac.webkit.org/changeset/212622
3135
3136 2017-02-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3137
3138         [GTK] Test fast/events/message-port-postMessage-recursive.html times out
3139         https://bugs.webkit.org/show_bug.cgi?id=168570
3140
3141         Reviewed by Michael Catanzaro.
3142
3143         This has recently been added and the patch is good. It's just revealing a problem with our timers. The test is
3144         posting a message recursively, and also starts a timeout timer to finish the test. The timeout timer is never
3145         fired for us, because WebCore timers have lower priority than the one used by
3146         postMessage. ScriptExecutionContext uses Document::postTask, that uses scheduleOnMainThread, that uses
3147         RunLoop::dispatch(). We are not setting any priority for the timer used by RunLoop::dispatch, so it's using the
3148         default. RunLoop::dispatch is normally used to schedule tasks between threads, or just to ensure something is
3149         run in a different run loop iteration, but in general nothing urgent as a graphics redraw or something like
3150         that. It's quite common to use g_idle_add to schedule tasks between threads, so I think it makes sense to use
3151         G_PRIORITY_DEFAULT_IDLE for the RunLoop timer.
3152
3153         * wtf/glib/RunLoopGLib.cpp:
3154         (WTF::RunLoop::RunLoop):
3155
3156 2017-02-19  Mark Lam  <mark.lam@apple.com>
3157
3158         CachedCall should let GC know to keep its arguments alive.
3159         https://bugs.webkit.org/show_bug.cgi?id=168567
3160         <rdar://problem/30475767>
3161
3162         Reviewed by Saam Barati.
3163
3164         Added a WTF_FORBID_HEAP_ALLOCATION that will cause a compilation failure if
3165         a class declared with it is malloced.
3166
3167         While this doesn't prevent that class declared WTF_FORBID_HEAP_ALLOCATION from
3168         being embedded in another class that is heap allocated, it does at minimum
3169         document the intent and gives the users of this class a chance to do the
3170         right thing.
3171
3172         * WTF.xcodeproj/project.pbxproj:
3173         * wtf/ForbidHeapAllocation.h: Added.
3174
3175 2017-02-19  Commit Queue  <commit-queue@webkit.org>
3176
3177         Unreviewed, rolling out r212466.
3178         https://bugs.webkit.org/show_bug.cgi?id=168577
3179
3180         causes crashes on AArch64 on linux, maybe it's causing crashes
3181         on iOS too (Requested by pizlo on #webkit).
3182
3183         Reverted changeset:
3184
3185         "The collector thread should only start when the mutator
3186         doesn't have heap access"
3187         https://bugs.webkit.org/show_bug.cgi?id=167737
3188         http://trac.webkit.org/changeset/212466
3189
3190 2017-02-18  Chris Dumez  <cdumez@apple.com>
3191
3192         Recursive MessagePort.postMessage() calls causes tab to become unresponsive
3193         https://bugs.webkit.org/show_bug.cgi?id=168548
3194         <rdar://problem/29808005>
3195
3196         Reviewed by Darin Adler.
3197
3198         Add API to retrieve all messages in the queue at once.
3199
3200         * wtf/MessageQueue.h:
3201
3202 2017-02-16  Alex Christensen  <achristensen@webkit.org>
3203
3204         Remove EFL-specific files in Source.
3205
3206         Rubber-stamped by Anders Carlsson.
3207
3208         * wtf/text/efl: Removed.
3209         * wtf/text/efl/TextBreakIteratorInternalICUEfl.cpp: Removed.
3210
3211 2017-02-10  Filip Pizlo  <fpizlo@apple.com>
3212
3213         The collector thread should only start when the mutator doesn't have heap access
3214         https://bugs.webkit.org/show_bug.cgi?id=167737
3215
3216         Reviewed by Keith Miller.
3217         
3218         Extend the use of AbstractLocker so that we can use more locking idioms.
3219
3220         * wtf/AutomaticThread.cpp:
3221         (WTF::AutomaticThreadCondition::notifyOne):
3222         (WTF::AutomaticThreadCondition::notifyAll):
3223         (WTF::AutomaticThreadCondition::add):
3224         (WTF::AutomaticThreadCondition::remove):
3225         (WTF::AutomaticThreadCondition::contains):
3226         (WTF::AutomaticThread::AutomaticThread):
3227         (WTF::AutomaticThread::tryStop):
3228         (WTF::AutomaticThread::isWaiting):
3229         (WTF::AutomaticThread::notify):
3230         (WTF::AutomaticThread::start):
3231         (WTF::AutomaticThread::threadIsStopping):
3232         * wtf/AutomaticThread.h:
3233         * wtf/NumberOfCores.cpp:
3234         (WTF::numberOfProcessorCores): Allow this to be overridden for testing.
3235         * wtf/ParallelHelperPool.cpp:
3236         (WTF::ParallelHelperClient::finish):
3237         (WTF::ParallelHelperClient::claimTask):
3238         (WTF::ParallelHelperPool::Thread::Thread):
3239         (WTF::ParallelHelperPool::didMakeWorkAvailable):
3240         (WTF::ParallelHelperPool::hasClientWithTask):
3241         (WTF::ParallelHelperPool::getClientWithTask):
3242         * wtf/ParallelHelperPool.h:
3243
3244 2017-02-16  Anders Carlsson  <andersca@apple.com>
3245
3246         Remove EFL from WTF
3247         https://bugs.webkit.org/show_bug.cgi?id=168452
3248
3249         Reviewed by Alex Christensen.
3250
3251         * wtf/CurrentTime.cpp:
3252         * wtf/DisallowCType.h:
3253         * wtf/FeatureDefines.h:
3254         * wtf/MainThread.cpp:
3255         * wtf/MainThread.h:
3256         * wtf/Platform.h:
3257         * wtf/RunLoop.h:
3258         * wtf/WorkQueue.h:
3259         * wtf/efl/DispatchQueueEfl.cpp: Removed.
3260         * wtf/efl/DispatchQueueEfl.h: Removed.
3261         * wtf/efl/DispatchQueueWorkItemEfl.h: Removed.
3262         * wtf/efl/EflTypedefs.h: Removed.
3263         * wtf/efl/MainThreadEfl.cpp: Removed.
3264         * wtf/efl/RunLoopEfl.cpp: Removed.
3265         * wtf/efl/UniquePtrEfl.h: Removed.
3266         * wtf/efl/WorkQueueEfl.cpp: Removed.
3267
3268 2017-02-13  Alex Christensen  <achristensen@webkit.org>
3269
3270         URLs with an invalid IPv4 address should be invalid
3271         https://bugs.webkit.org/show_bug.cgi?id=168260
3272
3273         Reviewed by Tim Horton.
3274
3275         * wtf/Expected.h:
3276         (WTF::Expected::value):
3277         Added missing WTFMove for rvalue Expected::value().
3278
3279 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
3280
3281         The current frame of an image should not deleted if another frame is asynchronously being decoded
3282         https://bugs.webkit.org/show_bug.cgi?id=167618
3283
3284         Reviewed by Simon Fraser.
3285
3286         Add ASSERT_IMPLIES() which should fire when a condition is true but the
3287         assertion is false.
3288
3289         * wtf/Assertions.h:
3290
3291 2017-02-13  Brady Eidson  <beidson@apple.com>
3292
3293         Followup to: Replace all WebKit Library Version checks in WK2 with SDK version checks.
3294         https://bugs.webkit.org/show_bug.cgi?id=168124
3295
3296         Reviewed by Geoffrey Garen.
3297
3298         * wtf/spi/darwin/dyldSPI.h:
3299
3300 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
3301
3302         Update custom line breaking iterators to the latest version of Unicode
3303         https://bugs.webkit.org/show_bug.cgi?id=168182
3304
3305         Reviewed by Zalan Bujtas.
3306
3307         ICU 55.1 supports loose / normal / strict line breaking rules. The oldest platform we ship
3308         on has a version of ICU >= that one. Therefore, we don't need to compile our own rules;
3309         we can just use ICU's rules.
3310
3311         * wtf/text/LineBreakIteratorPoolICU.h:
3312         (WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
3313         (WTF::LineBreakIteratorPool::take):
3314         * wtf/text/TextBreakIterator.cpp:
3315         (WTF::acquireLineBreakIterator):
3316         (WTF::openLineBreakIterator):
3317         (WTF::mapLineIteratorModeToRules): Deleted.
3318         (WTF::isCJKLocale): Deleted.
3319         * wtf/text/TextBreakIterator.h:
3320         (WTF::LazyLineBreakIterator::LazyLineBreakIterator):
3321         (WTF::LazyLineBreakIterator::mode):
3322         (WTF::LazyLineBreakIterator::get):
3323         (WTF::LazyLineBreakIterator::resetStringAndReleaseIterator):
3324         (WTF::LazyLineBreakIterator::isLooseCJKMode): Deleted.
3325
3326 2017-02-10  Dan Bernstein  <mitz@apple.com>
3327
3328         [Xcode] WTF installs extra copies of two headers outside /usr/local/include/wtf
3329         https://bugs.webkit.org/show_bug.cgi?id=168160
3330
3331         Reviewed by Sam Weinig.
3332
3333         * WTF.xcodeproj/project.pbxproj: Demoted OrdinalNumber.h MemoryFootprint.h from Private to
3334           Project.
3335
3336 2017-02-10  Commit Queue  <commit-queue@webkit.org>
3337
3338         Unreviewed, rolling out r212139.
3339         https://bugs.webkit.org/show_bug.cgi?id=168152
3340
3341         Caused some assertions (Requested by JoePeck on #webkit).
3342
3343         Reverted changeset:
3344
3345         "Fix misleading comment in RunLoop.h"
3346         https://bugs.webkit.org/show_bug.cgi?id=167832
3347         http://trac.webkit.org/changeset/212139
3348
3349 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
3350
3351         Fix misleading comment in RunLoop.h
3352         https://bugs.webkit.org/show_bug.cgi?id=167832
3353
3354         Reviewed by Sam Weinig.
3355
3356         * wtf/RunLoop.h:
3357         Mac initialization used to force using CFRunLoopGetMain(). Now however it just
3358         uses RunLoop::current which uses CFRunLoopGetCurrent(). So this comment that
3359         it can be done on any thread is misleading and can lead to incorrect behavior
3360         if it is actually done on a non-main thread on Mac.
3361
3362 2017-02-09  Alex Christensen  <achristensen@webkit.org>
3363
3364         Unreviewed, rolling out r212040.
3365
3366         Broke build.  I'm not surprised
3367
3368         Reverted changeset:
3369
3370         "[WebRTC][Mac] Activate libwebrtc"
3371         https://bugs.webkit.org/show_bug.cgi?id=167293
3372         http://trac.webkit.org/changeset/212040
3373
3374 2017-02-09  Youenn Fablet  <youenn@apple.com>
3375
3376         [WebRTC][Mac] Activate libwebrtc
3377         https://bugs.webkit.org/show_bug.cgi?id=167293
3378
3379         Reviewed by Alex Christensen.
3380
3381         * wtf/Platform.h:
3382
3383 2017-02-09  Brady Eidson  <beidson@apple.com>
3384
3385         Transition "WebKit Library Version" checks to SDK version checks.
3386         <rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
3387
3388         Reviewed by Geoffrey Garen.
3389
3390         * wtf/spi/darwin/dyldSPI.h: Add entries for the iOS 10.3, macOS 10.11, and macOS 10.12.4 SDKs.
3391
3392 2017-02-09  Commit Queue  <commit-queue@webkit.org>
3393
3394         Unreviewed, rolling out r211980 and r211987.
3395         https://bugs.webkit.org/show_bug.cgi?id=168072
3396
3397         Caused API test WebKit2.DuplicateCompletionHandlerCalls to
3398         fail (Requested by ryanhaddad on #webkit).
3399
3400         Reverted changesets:
3401
3402         "Transition "WebKit Library Version" checks to SDK version
3403         checks."
3404         https://bugs.webkit.org/show_bug.cgi?id=168056
3405         http://trac.webkit.org/changeset/211980
3406
3407         "Build fix for APPLE_INTERNAL_SDK builds after r211980."
3408         http://trac.webkit.org/changeset/211987
3409
3410 2017-02-09  Alexey Proskuryakov  <ap@apple.com>
3411
3412         Remove unused WebThreadRunSync
3413         https://bugs.webkit.org/show_bug.cgi?id=168024
3414
3415         Reviewed by Tim Horton.
3416
3417         * wtf/ios/WebCoreThread.cpp:
3418         * wtf/ios/WebCoreThread.h:
3419
3420 2017-02-09  Brady Eidson  <beidson@apple.com>
3421
3422         Build fix for APPLE_INTERNAL_SDK builds after r211980.
3423
3424         Unreviewed.
3425
3426         * wtf/spi/darwin/dyldSPI.h:
3427
3428 2017-02-09  Brady Eidson  <beidson@apple.com>
3429
3430         Transition "WebKit Library Version" checks to SDK version checks.
3431         <rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
3432
3433         Reviewed by Geoffrey Garen.
3434
3435         * wtf/spi/darwin/dyldSPI.h: Add entries for the iOS 10.3, macOS 10.11, and macOS 10.12.4 SDKs.
3436
3437 2017-02-06  Jer Noble  <jer.noble@apple.com>
3438
3439         Playback stalls when a SourceBuffer append causes frame eviction
3440         https://bugs.webkit.org/show_bug.cgi?id=167834
3441
3442         Reviewed by Eric Carlson.
3443
3444         Optimize the MediaTime class; specifically the compare() method. The class only
3445         needs 6 bits to store the TimeFlags, so make that a uint8_t rather than uint32_t.
3446         The implementation is slightly simpler if the TimeScale is unsigned, so make that
3447         a uint32_t rather than int32_t. Inline the comparison operators. Optimize the equality
3448         comparison by bitwise-and'ing the flags together and masking the result. Optimize for
3449         common comparison scenarios (equal timeScales, equal timeValues(), etc.). Attempt the
3450         mathematically simpler simpler method for comparing ratios, and only fall back to the
3451         complex method if the results of multiplying the timeScale by the timeValue overflows.
3452
3453         * wtf/MediaTime.cpp:
3454         (WTF::greatestCommonDivisor):
3455         (WTF::leastCommonMultiple):
3456         (WTF::signum):
3457         (WTF::MediaTime::MediaTime):
3458         (WTF::MediaTime::createWithFloat):
3459         (WTF::MediaTime::createWithDouble):
3460         (WTF::MediaTime::operator+):
3461         (WTF::MediaTime::operator-):
3462         (WTF::MediaTime::operator!):
3463         (WTF::MediaTime::operator bool):
3464         (WTF::MediaTime::compare):
3465         (WTF::MediaTime::setTimeScale):
3466         (WTF::abs):
3467         (WTF::MediaTime::operator<): Deleted.
3468         (WTF::MediaTime::operator>): Deleted.
3469         (WTF::MediaTime::operator!=): Deleted.
3470         (WTF::MediaTime::operator==): Deleted.
3471         (WTF::MediaTime::operator>=): Deleted.
3472         (WTF::MediaTime::operator<=): Deleted.
3473         * wtf/MediaTime.h:
3474
3475 2017-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
3476
3477         [GTK] Fix huge ENABLE_RESOURCE_USAGE warning spam
3478
3479         Unreviewed. We shouldn't redefine ENABLE_RESOURCE_USAGE in Platform.h as
3480         it's already defined in cmakeconfig.h.
3481
3482         * wtf/Platform.h:
3483
3484 2017-02-03  Joseph Pecoraro  <pecoraro@apple.com>
3485
3486         Performance Timing: Convert WTF::MonotonicTime and WTF::Seconds
3487         https://bugs.webkit.org/show_bug.cgi?id=167768
3488
3489         Reviewed by Geoffrey Garen.
3490
3491         * wtf/Stopwatch.h:
3492         (WTF::Stopwatch::elapsedTimeSince):
3493         (WTF::Stopwatch::elapsedTimeSinceMonotonicTime): Deleted.
3494
3495 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3496
3497         [GTK] Add initial implementation of resource usage overlay
3498         https://bugs.webkit.org/show_bug.cgi?id=167731
3499
3500         Reviewed by Michael Catanzaro.
3501
3502         Enable RESOURCE_USAGE for GTK+ port too.
3503
3504         * wtf/Platform.h:
3505
3506 2017-02-02  Andreas Kling  <akling@apple.com>
3507
3508         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
3509         <https://webkit.org/b/167491>
3510         <rdar://problem/30116072>
3511
3512         Reviewed by Antti Koivisto.
3513
3514         Add a WTF helper function for getting the current process's memory footprint.
3515
3516         * WTF.xcodeproj/project.pbxproj:
3517         * wtf/CMakeLists.txt:
3518         * wtf/MemoryFootprint.cpp:
3519         (WTF::memoryFootprint):
3520         * wtf/MemoryFootprint.h:
3521
3522 2017-02-02  Mark Lam  <mark.lam@apple.com>
3523
3524         Add a SIGILL crash analyzer to make debugging SIGILLs easier.
3525         https://bugs.webkit.org/show_bug.cgi?id=167714
3526         <rdar://problem/30318237>
3527
3528         Reviewed by Filip Pizlo.
3529
3530         * wtf/StdLibExtras.h:
3531
3532 2017-02-02  Commit Queue  <commit-queue@webkit.org>
3533
3534         Unreviewed, rolling out r211571 and r211582.
3535         https://bugs.webkit.org/show_bug.cgi?id=167751
3536
3537         This change caused API test WebKit1.MemoryPressureHandler to
3538         fail with an assertion. (Requested by ryanhaddad on #webkit).
3539
3540         Reverted changesets:
3541
3542         "[Mac] In-process memory pressure monitor for WebContent
3543         processes."
3544         https://bugs.webkit.org/show_bug.cgi?id=167491
3545         http://trac.webkit.org/changeset/211571
3546
3547         "Unreviewed attempt to fix the Windows build after r211571."
3548         http://trac.webkit.org/changeset/211582
3549
3550 2017-02-02  Andreas Kling  <akling@apple.com>
3551
3552         [Mac] In-process memory pressure monitor for WebContent processes.
3553         <https://webkit.org/b/167491>
3554         <rdar://problem/30116072>
3555
3556         Reviewed by Antti Koivisto.
3557
3558         Add a WTF helper function for getting the current process's memory footprint.
3559
3560         * WTF.xcodeproj/project.pbxproj:
3561         * wtf/CMakeLists.txt:
3562         * wtf/MemoryFootprint.cpp:
3563         (WTF::memoryFootprint):
3564         * wtf/MemoryFootprint.h:
3565
3566 2017-02-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3567
3568         Unreviewed, fix the WebKit nightly open source build
3569         <rdar://problem/30308635>
3570
3571         We cannot assume all internal SDKs have the latest WebKitAdditions, so we need an explicit header check here.
3572
3573         * wtf/Platform.h:
3574
3575 2017-02-01  Andreas Kling  <akling@apple.com>
3576
3577         Implement the alwaysRunsAtBackgroundPriority WK2 setting using thread QoS.
3578         <https://webkit.org/b/167387>
3579         <rdar://problem/29711409>
3580
3581         Reviewed by Antti Koivisto.
3582
3583         Add a new mechanism for overriding the max thread QoS level globally:
3584
3585             void setGlobalMaxQOSClass(qos_class_t)
3586             qos_class_t adjustedQOSClass(qos_class_t)
3587
3588         The QoS cap applies to all newly created threads, threads that try to override
3589         their QoS class manually, and also passed down to bmalloc.
3590
3591         * wtf/Threading.cpp:
3592         (WTF::setCurrentThreadIsUserInteractive):
3593         (WTF::setCurrentThreadIsUserInitiated):
3594         (WTF::setGlobalMaxQOSClass):
3595         (WTF::adjustedQOSClass):
3596         * wtf/Threading.h:
3597         * wtf/ThreadingPthreads.cpp:
3598         (WTF::createThreadInternal):
3599         * wtf/cocoa/WorkQueueCocoa.cpp:
3600         (WTF::dispatchQOSClass):
3601
3602 2017-01-31  Antti Koivisto  <antti@apple.com>
3603
3604         Teach cache coders&nb